Chapter 1. Developer's Guide

Table of Contents

1.1. Introduction
1.2. Basic Expectations
1.2.1. Expectation Value
1.2.2. Expectation List
1.2.3. Constraint List
1.2.4. Expectation Set
1.2.5. Expectation Map
1.2.6. Expectation Boundary
1.2.7. ExpectationCounter
1.2.8. TrackingCounter
1.2.9. ExpectationSegment
1.2.10. Return Object List
1.3. Advanced Expectations
1.3.1. Introduction to Advanced Mock Objects
1.3.2. Visitable Mock Objects
1.3.3. Chainable Mock Objects
1.3.4. Poor Man's Mock Objects
1.4. Helpers
1.4.1. Asserter
1.4.2. Formatter
1.4.3. Throwables
1.5. Support for Production Code
1.5.1. Reproducible Time Values
1.5.2. Accessing protected elements

1.1. Introduction

The following developer's guide is to get you started and to give you a quick overview over the features of mockpp. For a complete list of all functions please refer to the api documentation.

There are a few things that are not obvious but might become interesting:

  • mockpp uses a data type String which is no data type of it's own but is a typdef to std::string or std::wstring depending on your choice. It also provides a minumum functionality for unicode if you compile for a unicode environment. See Section A.3, “Compilation and Installation” how to do that.

    Since mockpp provides both environments with the same sources it uses some macros to convert string literals to the intended environment. You can check for the actual setting by adding a conditional #ifdef MOCKPP_UNICODE in your sources.

    • MOCKPP_PCHAR transforms a literal string either to a char* or to a wchar_t * by prepending an L for unicode.
    • In the same manner MOCKPP_STRING yields either a std::string or a std::wstring.
  • mockpp has no testing framework of it's own so it is recommended to use CppUnit for that purpose. See the test and example files how to do it.