New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pkg: add cn-cbor CBOR implementation plus unit tests #8467
pkg: add cn-cbor CBOR implementation plus unit tests #8467
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering, for the unittests you used "cncbor", while the package is called "cn-cbor" (with dash). IMO we should stick with one version of the naming. The former is shorter, but cabo himself put the dash in there...
* @file | ||
* @brief Unit tests for pkg cn-cbor. | ||
* | ||
* @author Lorenz Hüther |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if possible, please add email addresses
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fine with me, I've got to ask Mathias first though.
} buffer_t; | ||
|
||
typedef struct cbor_failure | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
opening brace goes one line up, like done for buffr_t.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will be fixed!
cn_cbor_error err; | ||
} cbor_failure; | ||
|
||
cn_cbor *cbor; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if these variables are only used in this file, please make them static.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it.
tests/pkg_cn-cbor/main.c
Outdated
@@ -0,0 +1,42 @@ | |||
/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with the unittests in place, I think the test is not needed anymore...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, noted!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
still here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, seems so. let me check...
@lorenz9314 Thanks for taking over! This is almost good to go, only minor issues. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please prepend the unittests commit with "tests/unittests: "
&inv)); | ||
|
||
for (offs = 0; offs < sizeof(tests) / sizeof(cbor_failure); offs++) { | ||
TEST_ASSERT(parse_hex(tests[offs].hex)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indent is off
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will be corrected...
@kaspar030 |
@lorenz9314 what's the status on this? Looks like we're close to green? |
44e8ad0
to
f5d8116
Compare
@emmanuelsearch Pretty much ready on my side as well, however I am still unable to rename the tests to tests-cn-cbor as this causes sthe build to fail during linking. I pushed the changes, but like I said, no luck with the name. |
@kaspar030 @bergzand any clues how to fix this issue? |
tests/pkg_cn-cbor/Makefile
Outdated
@@ -0,0 +1,10 @@ | |||
APPLICATION = pkg_cn-cbor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove this line, it is redundant
tests/pkg_cn-cbor/main.c
Outdated
@@ -0,0 +1,42 @@ | |||
/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
still here?
You can not have a dash in the unit test name because of c function naming rules. Name the directory tests-cn_cbor and it should work. |
@gebart Alright, done. Thanks! |
@lorenz9314 seems like squashing would make sense at this point? |
6b0bc90
to
927311e
Compare
927311e
to
7957ef5
Compare
@emmanuelsearch Done... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor things left. Feel free to directly squash.
pkg/cn-cbor/Makefile
Outdated
.PHONY: all | ||
|
||
all: git-download | ||
@cp Makefile.cn-cbor $(PKG_BUILDDIR)/src/Makefile |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please drop this line and directly use this Makefile in the next, like:
"$(MAKE)" -C $(PKG_BUILDDIR)/src -f $(CURDIR)/Makefile.cn-cbor
unsigned char *pntr; | ||
} buffer_t; | ||
|
||
typedef struct cbor_failure { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can remove the cbor_failure after "struct".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alright!
7957ef5
to
7117663
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK! Thanks for your patience. ;)
@kaspar030 Likewise! |
Contribution description
Adds the CBOR implementation cn-cbor to RIOT including unit tests. The test cases have been partially taken from cn-cbors original unit tests.
Issues/PRs references
The package itself has been taken from #8025, commits 772e877, fd7b6ab and ae2c180