Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
multipass
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
derf
multipass
Commits
a07d2385
"README.md" did not exist on "5bbc639dc8eced23dcc851a461c17273ef9d078d"
Commit
a07d2385
authored
6 years ago
by
Birte Kristina Friesel
Browse files
Options
Downloads
Patches
Plain Diff
prototest: restore nlohmann tests
parent
b3f9b25d
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitignore
+3
-0
3 additions, 0 deletions
.gitignore
src/app/prototest/Makefile.inc
+9
-0
9 additions, 0 deletions
src/app/prototest/Makefile.inc
src/app/prototest/main.cc
+34
-0
34 additions, 0 deletions
src/app/prototest/main.cc
with
46 additions
and
0 deletions
.gitignore
+
3
−
0
View file @
a07d2385
*.o
/build
/src/app/prototest/nanopb.pb.h
/src/app/prototest/nanopb.pb.cc
/src/app/prototest/nanopb.proto
This diff is collapsed.
Click to expand it.
src/app/prototest/Makefile.inc
+
9
−
0
View file @
a07d2385
loop
?=
1
ifeq
(${prototest_include_global}, 1)
COMMON_FLAGS
+=
-DPROTOTEST_INCLUDE_GLOBAL
endif
ifeq
(${prototest_include_local}, 1)
COMMON_FLAGS
+=
-DPROTOTEST_INCLUDE_LOCAL
endif
ifeq
(${prototest_arduinojson}, 1)
COMMON_FLAGS
+=
-DPROTOTEST_ARDUINOJSON
endif
ifeq
(${prototest_modernjson}, 1)
COMMON_FLAGS
+=
-DPROTOTEST_MODERNJSON
ostream
=
1
endif
ifeq
(${prototest_mpack}, 1)
...
...
This diff is collapsed.
Click to expand it.
src/app/prototest/main.cc
+
34
−
0
View file @
a07d2385
...
...
@@ -28,6 +28,10 @@
#include
<stdint.h>
#ifdef PROTOTEST_INCLUDE_GLOBAL
#include
"prototest_global.cc.inc"
#endif
#ifdef PROTOTEST_XDR
char
buf
[
256
];
#endif
...
...
@@ -50,6 +54,10 @@ void loop(void)
{
static
uint16_t
ts
=
0
;
#ifdef PROTOTEST_INCLUDE_LOCAL
#include
"prototest_local.cc.inc"
#endif
/*
* XDR
*/
...
...
@@ -98,6 +106,32 @@ void loop(void)
kout
<<
"sensor: "
<<
sensor
<<
endl
;
#endif
/*
* ModernJSON
*/
#ifdef PROTOTEST_MODERNJSON
nlohmann
::
json
js1
;
js1
[
"sensor"
]
=
"gps"
;
js1
[
"time"
]
=
ts
;
js1
[
"data"
]
=
{
48.756080
,
2.302038
};
kout
<<
js1
.
dump
()
<<
endl
;
nlohmann
::
json
js2
=
{
{
"sensor"
,
"gps"
},
{
"time"
,
ts
},
{
"data"
,
{
48.756080
,
2.302038
}
}
};
kout
<<
js2
.
dump
()
<<
endl
;
std
::
vector
<
std
::
uint8_t
>
v_cbor
=
nlohmann
::
json
::
to_cbor
(
js2
);
kout
<<
"CBOR vector is "
<<
hex
;
for
(
unsigned
int
i
=
0
;
i
<
v_cbor
.
size
();
i
++
)
{
kout
<<
v_cbor
[
i
]
<<
" "
;
}
kout
<<
endl
;
#endif
/*
* NanoPB
*/
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment