STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
test_gnss_frame.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "gnss_frame.h"
Include dependency graph for test_gnss_frame.c:

Go to the source code of this file.

Classes

struct  counts_t

Macros

#define CHECK(condition)

Functions

static counts_t feed (gnss_frame_parser_t *p, const uint8_t *bytes, size_t n)
static counts_t feed_str (gnss_frame_parser_t *p, const char *s)
static void test_valid_frames (void)
static void test_lowercase_checksum (void)
static void test_wrong_nmea_checksum (void)
static void test_corrupt_ubx (void)
static void test_noise_then_frame (void)
static void test_overlong_and_binary_nmea (void)
static void test_ubx_length_limit (void)
int main (void)

Variables

static const char gga []
static const char txt [] = "$GNTXT,01,01,02,u-blox AG - www.u-blox.com*4E\r\n"
static const uint8_t ack []

Macro Definition Documentation

◆ CHECK

#define CHECK ( condition)
Value:
do { \
if (!(condition)) { \
fprintf(stderr, "%s:%d: %s\n", __FILE__, __LINE__, #condition); \
exit(1); \
} \
} while (0)

Definition at line 7 of file test_gnss_frame.c.

Referenced by test_corrupt_ubx(), test_lowercase_checksum(), test_noise_then_frame(), test_overlong_and_binary_nmea(), test_ubx_length_limit(), test_valid_frames(), and test_wrong_nmea_checksum().

Function Documentation

◆ feed()

counts_t feed ( gnss_frame_parser_t * p,
const uint8_t * bytes,
size_t n )
static

◆ feed_str()

counts_t feed_str ( gnss_frame_parser_t * p,
const char * s )
static

◆ main()

◆ test_corrupt_ubx()

void test_corrupt_ubx ( void )
static

Definition at line 77 of file test_gnss_frame.c.

References ack, CHECK, feed(), gnss_frame_init(), p, and counts_t::ubx.

Referenced by main().

◆ test_lowercase_checksum()

void test_lowercase_checksum ( void )
static

Definition at line 56 of file test_gnss_frame.c.

References CHECK, feed_str(), gnss_frame_init(), and p.

Referenced by main().

◆ test_noise_then_frame()

void test_noise_then_frame ( void )
static

Definition at line 89 of file test_gnss_frame.c.

References CHECK, feed(), feed_str(), gga, gnss_frame_init(), and p.

Referenced by main().

◆ test_overlong_and_binary_nmea()

void test_overlong_and_binary_nmea ( void )
static

Definition at line 100 of file test_gnss_frame.c.

References CHECK, feed_str(), gnss_frame_init(), and p.

Referenced by main().

◆ test_ubx_length_limit()

void test_ubx_length_limit ( void )
static

Definition at line 113 of file test_gnss_frame.c.

References ack, CHECK, feed(), gnss_frame_init(), and p.

Referenced by main().

◆ test_valid_frames()

void test_valid_frames ( void )
static

Definition at line 44 of file test_gnss_frame.c.

References ack, CHECK, feed(), feed_str(), gga, gnss_frame_init(), counts_t::nmea, p, txt, and counts_t::ubx.

Referenced by main().

◆ test_wrong_nmea_checksum()

void test_wrong_nmea_checksum ( void )
static

Definition at line 63 of file test_gnss_frame.c.

References CHECK, feed_str(), gga, gnss_frame_init(), and p.

Referenced by main().

Variable Documentation

◆ ack

const uint8_t ack[]
static
Initial value:
= {0xB5, 0x62, 0x05, 0x01, 0x02,
0x00, 0x06, 0x8A, 0x98, 0xC1}

Definition at line 41 of file test_gnss_frame.c.

Referenced by on_valset(), sendReplyTo(), test_corrupt_ubx(), test_frame_roundtrip_through_parser(), test_ubx_length_limit(), and test_valid_frames().

◆ gga

const char gga[]
static
Initial value:
=
"$GPGGA,123519,4807.038,N,01131.000,E,1,08,0.9,545.4,M,46.9,M,,*47\r\n"

Definition at line 38 of file test_gnss_frame.c.

Referenced by fake_gnss_emit(), test_noise_then_frame(), test_valid_frames(), and test_wrong_nmea_checksum().

◆ txt

const char txt[] = "$GNTXT,01,01,02,u-blox AG - www.u-blox.com*4E\r\n"
static

Definition at line 40 of file test_gnss_frame.c.

Referenced by test_valid_frames().