O'Reilly logo

Learn Qt 5 by Nicholas Sherriff

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

DataDecorator tests

In Chapter 5, Data, we created various classes deriving from DataDecorator. Let's create companion test classes for each of those and test the following functionalities:

  • Object construction
  • Setting the value
  • Getting the value as JSON
  • Updating the value from JSON

In cm-tests/source/data, create the DateTimeDecoratorTests, EnumeratorDecoratorTests, IntDecoratorTests, and StringDecoratorTests classes.

Let’s begin with the simplest suite, IntDecoratorTests. The tests will be broadly similar across the suites, so once we’ve written one suite, we will be able to copy most of it across to the other suites and then supplement as necessary.

int-decorator-tests.h:

#ifndef INTDECORATORTESTS_H
#define INTDECORATORTESTS_H
#include ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required