Merge branch 'xiaoxiang781216-max'
This commit is contained in:
commit
a3813b8449
4
minmea.c
4
minmea.c
@ -46,10 +46,6 @@ bool minmea_check(const char *sentence, bool strict)
|
|||||||
{
|
{
|
||||||
uint8_t checksum = 0x00;
|
uint8_t checksum = 0x00;
|
||||||
|
|
||||||
// Sequence length is limited.
|
|
||||||
if (strlen(sentence) > MINMEA_MAX_SENTENCE_LENGTH + 3)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// A valid sentence starts with "$".
|
// A valid sentence starts with "$".
|
||||||
if (*sentence++ != '$')
|
if (*sentence++ != '$')
|
||||||
return false;
|
return false;
|
||||||
|
4
tests.c
4
tests.c
@ -18,6 +18,8 @@
|
|||||||
|
|
||||||
static const char *valid_sentences_nochecksum[] = {
|
static const char *valid_sentences_nochecksum[] = {
|
||||||
"$GPTXT,xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
"$GPTXT,xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
||||||
|
"$GPTXT,xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||||
|
"xxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
||||||
"$GPTXT,hello\n",
|
"$GPTXT,hello\n",
|
||||||
"$GPTXT,hello\r",
|
"$GPTXT,hello\r",
|
||||||
"$GPTXT,hello\r\n",
|
"$GPTXT,hello\r\n",
|
||||||
@ -51,8 +53,6 @@ static const char *valid_sentences_checksum[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static const char *invalid_sentences[] = {
|
static const char *invalid_sentences[] = {
|
||||||
"$GPTXT,xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
|
||||||
"xxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
|
||||||
"$GPTXT,01,01,02,ANTSTATUS=INIT*26",
|
"$GPTXT,01,01,02,ANTSTATUS=INIT*26",
|
||||||
"$GPRMC,,V,,,,,,,,,,N*532",
|
"$GPRMC,,V,,,,,,,,,,N*532",
|
||||||
"$GPVTG,,,,\xff,,,,,N*30",
|
"$GPVTG,,,,\xff,,,,,N*30",
|
||||||
|
Loading…
Reference in New Issue
Block a user