Boost.Test > Examples > unit_test_example5
Boost Test logo

The Unit Test Framework example 5

Rationale: this moderately complex example presents test program for the family of trivial hash functions. On the way among other things it demonstrates:
  • an ability to construct parameterized test cases based on user class's member function
  • usage of shared instance of user test case
  • ability to store test case parameters in user test case
Input: This example not require input in a following format:
string hash-value
string hash-value

hash-value is positive integer. hash-value -1 designate expected "wrong length" error.
hash-value -2 designate expected "non-alphabet letter in string" error. Here is an example input:
Output: If you use supplied input like this: unit_test_example5 < unit_test_example5.input, you will get:
Enter alphabet (4 characters without delimiters)

Enter test data in a format [string] [value] to check correct calculation
Enter test data in a format [string] -1 to check long string validation
Enter test data in a format [string] -2 to check invalid argument string validation

Running 1 test case...

*** No errors detected
Source: unit_test_example5.cpp