[Spice-devel] [PATCH spice-streaming-agent 0/4] first unit test and options parsing improvements

Lukáš Hrázký lhrazky at redhat.com
Wed Jan 31 11:57:56 UTC 2018


This series introduces a C++ unit test framework called Catch to the
codebase, adds a simple unit test for the options parsing for the mjpeg
plugin and improves on the option parsing code.

It depends on the header split-off from the previous patch set ([PATCH
spice-streaming-agent 1/2] mjpeg plugin: split off the declaration into
a header).

The unit test framework choice is a subject to discussion. Note Catch is
quite new and it only has a package in Fedora 27.

1/4 is there because otherwise I'd have to flip AC_LANG(C++) on and off
later on.

The tests in 2/4 do not pass until 4/4, TDD excersize :)

3/4 is using BDD-style [1] test structure which I quite like, I wrote
the tests in two steps so I'm including the patch for comparison.

Cheers,
Lukas

[1] https://en.wikipedia.org/wiki/Behavior-driven_development

Lukáš Hrázký (4):
  configure.ac: remove header check for stream-device.h
  mjpeg-fallback: unittest for the options parsing
  mjpeg-fallback-test: use BDD structure for test cases
  mjpeg-fallback: a more C++ way of handling options

 configure.ac                          |  7 ++---
 src/mjpeg-fallback.cpp                | 47 +++++++++++++++-------------
 src/mjpeg-fallback.hpp                |  1 +
 src/unittests/Makefile.am             | 12 ++++++++
 src/unittests/test-mjpeg-fallback.cpp | 58 +++++++++++++++++++++++++++++++++++
 5 files changed, 100 insertions(+), 25 deletions(-)
 create mode 100644 src/unittests/test-mjpeg-fallback.cpp

-- 
2.16.1



More information about the Spice-devel mailing list