Commit Graph

68 Commits

Author SHA1 Message Date
Kosma Moczek
a0da280f64 add test_minmea_parse_vtg3 (fixes #57) 2022-06-03 01:40:30 +02:00
Kosma Moczek
1e2f0af7d8 rename MINMEA_MAX_LENGTH -> MINMEA_MAX_SENTENCE_LENGTH 2022-06-03 01:24:58 +02:00
Kosma Moczek
6915c08c59
Merge pull request #45 from benpicco/minmea_getdate
add minmea_getdatetime()
2022-06-03 01:15:07 +02:00
Kosma Moczek
926077436a tests: add tests for minmea_getdatetime 2022-06-03 01:10:22 +02:00
Kosma Moczek
74a4744792
Merge pull request #41 from vpetrigo/update/allow_only_CR_ending
minmea: Allow lines with only CR ending
2022-06-03 00:46:30 +02:00
Kosma Moczek
908846d4f6 add tests for newline handling 2022-06-03 00:45:37 +02:00
roman.storozhenko
252a3f9d3b Add GBS parser
Signed-off-by: roman.storozhenko <roman.storozhenko@pixelsmatter.com>
2022-05-20 09:22:45 -04:00
Chris Morgan
d8b411fe15 tests.c - Fix 'format-security' warnings due to use of ck_assert_msg() without a formatting string
https://fedoraproject.org/wiki/Format-Security-FAQ#What_is_-Wformat-security

tests.c: In function ‘test_minmea_check_fn’:
tests.c:79:9: error: format not a string literal and no format arguments [-Werror=format-security]
   79 |         ck_assert_msg(minmea_check(*sentence, false) == true, *sentence);
      |         ^~~~~~~~~~~~~
tests.c:80:9: error: format not a string literal and no format arguments [-Werror=format-security]
   80 |         ck_assert_msg(minmea_check(*sentence, true) == false, *sentence);
      |         ^~~~~~~~~~~~~
tests.c:84:9: error: format not a string literal and no format arguments [-Werror=format-security]
   84 |         ck_assert_msg(minmea_check(*sentence, false) == true, *sentence);
      |         ^~~~~~~~~~~~~
tests.c:85:9: error: format not a string literal and no format arguments [-Werror=format-security]
   85 |         ck_assert_msg(minmea_check(*sentence, true) == true, *sentence);
      |         ^~~~~~~~~~~~~
tests.c:89:9: error: format not a string literal and no format arguments [-Werror=format-security]
   89 |         ck_assert_msg(minmea_check(*sentence, false) == false, *sentence);
      |         ^~~~~~~~~~~~~
tests.c:90:9: error: format not a string literal and no format arguments [-Werror=format-security]
   90 |         ck_assert_msg(minmea_check(*sentence, true) == false, *sentence);
      |         ^~~~~~~~~~~~~
2022-05-20 08:41:55 -04:00
gdpinchina
61c6ef7ddd
fix test for gga 2018-09-19 14:38:49 +08:00
gdpinchina
4514f6dd5e
fix test for gga 2018-09-19 14:29:19 +08:00
gdpinchina
113221d7a9
fix test for gga 2018-09-19 14:15:51 +08:00
gdpinchina
35b00bca2f
fix test in gga 2018-09-19 14:01:55 +08:00
gdpinchina
9fcd2450f5
remove indent 2018-09-08 14:14:43 +08:00
gdpinchina
59c3e0a813
fix gga char alignment problem in test.c
In c compiler, a char takes 4 bytes in a structure though its size is 1 bytes. The initialization for `struct minmea_sentence_gga`:
```
    struct minmea_sentence_gga expected = {
        .time = { 12, 35, 19, 0 },
        .latitude = { 4807038, 1000 },
        .longitude = { 1131000, 1000 },
        .fix_quality = 1,
        .satellites_tracked = 8,
        .hdop = { 9, 10 },
        .altitude = { 5454, 10 },
        .altitude_units = 'M',
        .height = { 469, 10 },
        .height_units = 'M',
        .dgps_age = { 0, 0 },
    };
```
has the binary sequence like these:
```
0c 00 00 00 23 00 00 00 13 00 00 00 00 00 00 00 7e 59 49 00 e8 03 00 00 f8 41 11 00 e8 03 00 00 01 00 00 00 08  
00 00 00 09 00 00 00 0a 00 00 00 4e 15 00 00 0a 00 00 00 4d cc cc cc d5 01 00 00 0a 00 00 00 4d cc cc cc 00 00 
00 00 00 00 00 00
```
which the `4d cc cc cc` is the `'M'`, and cause memcmp return none zero. Therefore I add some code to remove `cc cc cc`:
```
memset(&expected.altitude_units + 1, 0, 3);
memset(&expected.height_units + 1, 0, 3);
```
2018-09-08 14:12:10 +08:00
gdpinchina
79b964a5b2
modefy initialization for dgps_age
modefy initialization for dgps_age
2018-09-08 13:10:06 +08:00
asund
f50449ea69 Fixup whitespace 2017-10-20 09:52:51 -07:00
asund
80af9b4838 * Arrange year interpretation in order of likeliness
* Add unit tests
2017-10-13 22:05:24 -07:00
Kosma Moczek
fcc63a54b0 Merge pull request #24 from kosma/zda
Merge branch 'zda'
2017-08-15 10:35:09 +02:00
Kosma Moczek
f1871e40b9 add unit tests for ZDA 2017-08-15 10:32:40 +02:00
Anthony Brice
137824049b NULL terminate array as test_minmea_check expects 2016-06-10 20:12:36 -07:00
lvitya
95f6beec4f Add $--VTG sentences.
* Fix padding problem in test_minmea_parse_gll1
* Add support for $--VTG sentences.
* Add tests for $--VTG sentences.
* Fix padding problem in test_minmea_parse_gll1. 2nd attempt.
2016-04-23 21:19:26 +02:00
Kosma Moczek
ae62148805 add minmea_checksum 2014-09-11 18:02:29 +02:00
Kosma Moczek
103a523096 tests.c: rename sequence -> sentence (I was drunk at the time?) 2014-09-11 15:29:53 +02:00
Kosma Moczek
bf0f7d30f9 [API CHANGE] minmea_check: add "strict" argument
In strict mode, non-checksummed frames are discarded.
2014-09-11 15:29:53 +02:00
Kosma Moczek
ea324ed49f tests.c: squash GCC's complaints, I'm tired of this shit 2014-09-02 23:08:14 +02:00
Kosma Moczek
b763062f8d tests.c: work around spurious compiler error when comparing large ints 2014-09-02 22:41:00 +02:00
Kosma Moczek
e81f908109 minmea_scan("f"): allow spaces at the start of the field 2014-07-30 15:18:22 +02:00
Kosma Moczek
b777fbe0b9 minmea_gettimeofday -> minmea_gettime 2014-07-11 12:18:47 +02:00
Kosma Moczek
7786885eef tests.c: shorter & consistent variable names 2014-06-18 11:41:41 +02:00
Kosma Moczek
eb6baa182e tests.c: add assert_float_eq() macro 2014-06-18 11:39:06 +02:00
Evgueni Souleimanov
40b3fdd80d tests: use fabsf (float), not fabs (double) in epsilon comparisons of floats
Fixes a mistake in commit f68eb7c
2014-06-17 21:23:09 -04:00
Evgueni Souleimanov
74e2ce002e add test for shorter GSV sentence, with 0 to 4 satellites 2014-06-17 20:46:21 -04:00
Evgueni Souleimanov
f68eb7c9fd fix "warning: comparing floating point with == or != is unsafe" (epsilon comparison)
Instead of comparing floats "x == y", perform comparison
"fabs(x - y) <= epsilon", where epsilon is acceptable error that
accumulates in computation of x and/or y.

Because in this case all integers are small and all floats are exactly
representable under IEEE754, epsilon may be zero in our tests.

This warning occurred when compiling using

gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-3)

on CentOS 6.5 x86_64

using the following CFLAGS (locally inserted into Makefile)

CFLAGS = -g -Wall -Wextra -Wformat=2 -funsigned-char -fstrict-aliasing
 -Wstrict-aliasing -Wfloat-equal -Wundef -Wuninitialized -Wpointer-arith
 -Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings -Waddress
 -Waggregate-return -Wstrict-prototypes -Wold-style-declaration
 -Wold-style-definition -Wmissing-parameter-type -Wmissing-prototypes
 -Wmissing-declarations -Wmissing-field-initializers -Wmissing-noreturn
 -Wmissing-format-attribute -Wpacked -Wredundant-decls -Wnested-externs
 -Wshadow -Wsign-compare -Wlogical-op -std=c99

and this make command:

make clean ; make example tests
2014-06-17 20:35:32 -04:00
Evgueni Souleimanov
52c077c5ac undo commit "tests: prevent compiler warning when comparing floats" 2014-06-17 20:35:32 -04:00
Evgueni Souleimanov
2ae5c4a645 fix "warning: no previous prototype for 'minmea_suite'"
This warning occurred when compiling using

gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-3)

on CentOS 6.5 x86_64

using the following CFLAGS (locally inserted into Makefile)

CFLAGS = -g -Wall -Wextra -Wformat=2 -funsigned-char -fstrict-aliasing
 -Wstrict-aliasing -Wfloat-equal -Wundef -Wuninitialized -Wpointer-arith
 -Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings -Waddress
 -Waggregate-return -Wstrict-prototypes -Wold-style-declaration
 -Wold-style-definition -Wmissing-parameter-type -Wmissing-prototypes
 -Wmissing-declarations -Wmissing-field-initializers -Wmissing-noreturn
 -Wmissing-format-attribute -Wpacked -Wredundant-decls -Wnested-externs
 -Wshadow -Wsign-compare -Wlogical-op -std=c99

and this make command:

make clean ; make example tests
2014-06-17 20:35:26 -04:00
Evgueni Souleimanov
0fc9cea986 fix "warning: old-style function definition"
This warning occurred when compiling using

gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-3)

on CentOS 6.5 x86_64

using the following CFLAGS (locally inserted into Makefile)

CFLAGS = -g -Wall -Wextra -Wformat=2 -funsigned-char -fstrict-aliasing
 -Wstrict-aliasing -Wfloat-equal -Wundef -Wuninitialized -Wpointer-arith
 -Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings -Waddress
 -Waggregate-return -Wstrict-prototypes -Wold-style-declaration
 -Wold-style-definition -Wmissing-parameter-type -Wmissing-prototypes
 -Wmissing-declarations -Wmissing-field-initializers -Wmissing-noreturn
 -Wmissing-format-attribute -Wpacked -Wredundant-decls -Wnested-externs
 -Wshadow -Wsign-compare -Wlogical-op -std=c99

and this make command:

make clean ; make example tests
2014-06-17 20:35:15 -04:00
Evgueni Souleimanov
1b3147c7e0 fix "warning: declaration of 'time' shadows a global declaration" (-Wshadow)
This warning occurred when compiling using

gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-3)

on CentOS 6.5 x86_64

using the following CFLAGS (locally inserted into Makefile)

CFLAGS = -g -Wall -Wextra -Wformat=2 -funsigned-char -fstrict-aliasing
 -Wstrict-aliasing -Wfloat-equal -Wundef -Wuninitialized -Wpointer-arith
 -Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings -Waddress
 -Waggregate-return -Wstrict-prototypes -Wold-style-declaration
 -Wold-style-definition -Wmissing-parameter-type -Wmissing-prototypes
 -Wmissing-declarations -Wmissing-field-initializers -Wmissing-noreturn
 -Wmissing-format-attribute -Wpacked -Wredundant-decls -Wnested-externs
 -Wshadow -Wsign-compare -Wlogical-op -std=c99

and this make command:

make clean ; make example tests
2014-06-17 20:33:47 -04:00
Kosma Moczek
7477e3caa3 minmea_parse_gll: make mode field optional 2014-06-17 15:00:51 +02:00
Kosma Moczek
f9394d2915 minmea_sentence_gll: adapt for new floating point format 2014-06-17 14:57:08 +02:00
Kosma Moczek
531192598d test_minmea_parse_gll1: keep naming consistent 2014-06-17 14:53:27 +02:00
Kosma Moczek
c375b8144b merge with master 2014-06-17 14:52:46 +02:00
Kosma Moczek
df695c4933 tests: prevent compiler warning when comparing floats 2014-06-17 12:22:48 +02:00
Kosma Moczek
334e63d599 tests.c: add minmea_scan("f") overflow tests 2014-04-27 17:05:21 +02:00
Kosma Moczek
14437a9631 [API change] add struct minmea_float w/ int_least32_t
This is an API breaker that incorporates the following big changes:

1. The (value, scale) float, as used in minmea, is a compound type. It
should be declared and used as such.

2. Some platforms, notably avr-gcc, have 16-bit ints. Make life easier
for them by using int_least32_t for floating point values.

3. As a side effect, the following functions were renamed:

* minmea_coord -> minmea_tocoord
* minmea_float -> minmea_tofloat

Migration guide for user code (easy unless you do fancy stuff):

1. Replace calls to minmea_{coord,float}.

2. Replace int32_t with int_least32_t in user code if your platform
requires this.
2014-04-27 16:22:37 +02:00
Kosma Moczek
6473d5b30e Merge commit 'pull/origin/5' 2014-04-24 16:02:40 +02:00
Kosma Moczek
e2e6a41209 tests.c: fix build errors introduced by #4
My bad for not checking this.
2014-04-24 15:58:12 +02:00
Kosma Moczek
08d28a590a Merge pull request #3 from eketh/master
Added support for GST frame
2014-04-24 11:55:54 +02:00
Kosma Moczek
b5b080cdaf Merge pull request #4 from mek-x/fix_gcc
Fixing compilation and tests for GCC on Linux
2014-04-24 11:32:20 +02:00
mek_x
daed9fd707 tests: added unit tests for gsv 2014-04-24 00:08:33 +02:00
mek_x
92a46f24e2 fix tests for gcc 2014-04-23 23:05:33 +02:00