[
https://issues.apache.org/jira/browse/DISPATCH-1568?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17036495#comment-17036495
]
ASF GitHub Bot commented on DISPATCH-1568:
------------------------------------------
nicob87 commented on pull request #684: WIP: (Work In Progress) DISPATCH-1568:
using doctest
URL: https://github.com/apache/qpid-dispatch/pull/684
- Demo using the library that Jiri Daněk suggested in the issue, it seems to
be a very nice option for several reasons, it is an evolution of catch2,
compile time significantly smaller, support nested "subcases" which simplifyes
setup and teardown, it is a single header file, and others.
see: https://github.com/onqtam/doctest
- jira: https://issues.apache.org/jira/browse/DISPATCH-1568
- Commit history will be fixed. a lot of junk for now.
- To run the demo, just:
```
[nbrignon@localhost build (nb-doctest)]$ cmake ..
...
[nbrignon@localhost build (nb-doctest)]$ make c_unittest
...
```
- and then we can execute the binary directly:
```
[nbrignon@localhost build (nb-doctest)]$ ./tests/c_unittest
[doctest] doctest version is "2.3.6"
[doctest] run with "--help" for options
===============================================================================
[doctest] test cases: 5 | 5 passed | 0 failed | 0 skipped
[doctest] assertions: 15 | 15 passed | 0 failed |
[doctest] Status: SUCCESS!
```
- or debug it:
```
[nbrignon@localhost build (nb-doctest)]$ gdb ./tests/c_unittest
...
(gdb) b safe_snprintf
Breakpoint 1 at 0x408330
(gdb) run
...
Breakpoint 1, safe_snprintf (str=str@entry=0x7fffffffcd00 "
\313\371\367\377\177", size=size@entry=19, format=format@entry=0x4228d2
"something")
at /home/nbrignon/qpid-dispatch/src/router_core/terminus.c:89
89 size_t safe_snprintf(char *str, size_t size, const char *format,
...) {
```
- or execute it through ctest:
```
nbrignon@localhost build (nb-doctest)]$ ctest -VV -R c_unittest
...
test 1
Start 1: c_unittest
1: Test command: /home/nbrignon/qpid-dispatch/build/tests/c_unittest
1: Test timeout computed to be: 600
1: [doctest] doctest version is "2.3.6"
1: [doctest] run with "--help" for options
1:
===============================================================================
1: [doctest] test cases: 5 | 5 passed | 0 failed | 0
skipped
1: [doctest] assertions: 15 | 15 passed | 0 failed |
1: [doctest] Status: SUCCESS!
1/1 Test #1: c_unittest ....................... Passed 0.01 sec
The following tests passed:
c_unittest
100% tests passed, 0 tests failed out of 1
Total Test time (real) = 0.01 sec
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> add c-unittest support
> ----------------------
>
> Key: DISPATCH-1568
> URL: https://issues.apache.org/jira/browse/DISPATCH-1568
> Project: Qpid Dispatch
> Issue Type: Improvement
> Components: Router Node
> Reporter: Nicolas
> Priority: Major
> Original Estimate: 336h
> Remaining Estimate: 336h
>
> Right now we are not using any framework for easily write c unit-test when
> developing (or later).
> The idea is to research available libraries, pick one and try to include in
> our workflow.
> preliminary candidates:
> [https://github.com/google/googletest]
> https://github.com/catchorg/Catch2
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]