Thread: libpqxx: improved self-test

libpqxx: improved self-test

From
"Jeroen T. Vermeulen"
Date:
The test programs bundled with libpqxx, the alternative C++ frontend for
postgresql, have just been extended to cover all methods of the Result
class and all classes within it.  Tests 11 and 12 have been added tonight.  
The test programs can be run automatically from the Makefile to perform an 
automated self-test of the library.  The test coverage undertaking has
revealed one bug so far, but none were uncovered by the latest additions.

The Result class (and its nested menagerie) have been the largest hurdle
towards full method coverage by the test programs.  Five other classes
still contain methods that are not exercised by the test code; these are 
nowhere near as large or complex as the Result-related classes.  A list of
untested methods is given below.

After all library methods are covered by the self test, the next
milestone will be the porting of a significant application (the Little
Brother network monitor, http://littlebrother.sourceforge.net/).  Once
these two objectives have been achieved, I think libpqxx will be ready 
for possible inclusion in the main PostgreSQL source tree.  If accepted,
I hope libpqxx will become the standard C++ API for the database and
eventually even be ported to other databases.

For source code, future plans &c. see my home page:

http://members.ams.chello.nl/j.vermeulen31/proj-libpqxx.html

Feedback appreciated!


Jeroen

[List of methods not directly exercised by current test code.]
[Methods marked [1] are near-trivial, I hope; ones marked [2] are called 
indirectly by the test suite.]

Cursor:
Result_size_type SetCount(Result_size_type);            // [2]
Result Fetch(Result_size_type);                    // [2]
static Result_size_type NEXT();                    // [1]
static Result_size_type PRIOR();                // [1]
static Result_size_type BACKWARD_ALL();                // [1]
bool operator!() const;                        // [1]
Cursor &operator+=(Result_size_type);
Cursor &operator-=(Result_size_type);

TableReader:
bool operator!() const;                        // [1]
bool GetRawLine(std::string &);                    // [2]
void Tokenize(std::string, TUPLE &) const;            // [2]

TableStream:
std::string Name() const;                    // [1]
Transaction &Trans() const;                    // [1]
std::string NullStr() const;

TableWriter:
template<typename TUP> void push_back(const TUP &T);        // [1]
template<typename TUP> std::string ezinekoT(const TUP &) const; // [2]

Transactor:
void OnAbort(const char Reason[]) throw ();            // [1]
void OnCommit();                        // [1]
std::string Name() const;                    // [1]