This site totally sucks when viewed on a smartphone.
I'll fix this Real Soon Now.
Why Unit Testing? Testing a computer program from its visible user interface is like trying to test this advanced computer chip from its two external pins: ------------------------- In --->[ One Million Transistors ]---> Out ------------------------- Unit testing software source code is like testing each design cell of a complex chip in complete isolation.
Memory management, automated testing, debugging and utility
as well as GNU-Style Makefiles that you will find useful for most C++ projects.
To build libmdc, you will need to build and install the Boost C++ Libraries on your system. If you use Linux, check to see whether your distribution already provides a Boost package, and use that.
To test libmdc, you will need the CPPUnit C++ unit test framework. Note that you can build and use libmdc without building or running the unit tests.
This release requires GNU Make to build. However, it should be easy to use the source files with other build systems. I will be supporting other environments such as the Freescale CodeWarrior Development Tools, Texas Instruments Code Composer Studio and Microsoft Visual C++ soon.
The November 12, 2005 Release was tested with Fedora Core 4 GNU/Linux on a Pentium III and Mac OS X 10.3.9 on a Blue and White PowerPC G3 Macintosh.
Large Scale C++ Software Design
Proper documentation remains to be written. However, most of the header files have some documentation comments. Also look at the unit tests (*.t.cpp) for sample code.
The CPPUnit.mk and CPPUnit.t.mk unit test compilation framework is fully documented in the form of a long comment at the beginning of CPPUnit.mk. The Makefile is also fully commented to help you understand how to use CPPUnit.mk.
Before you write too many unit tests for your own code, I recommend you purchase a copy of John Lakos' excellent book Large Scale C++ Software Design. Read chapters 4 - Physical Heirarchy - and 5 - levelization - first.
I cannot emphasize strongly enough the importance of reading Lakos' book.
Mike Crawford's C++ Library Memory management, testing, debugging and utility classes, useful in most C++ projects. June 22, 2012 Release http://www.dulcineatech.com/source-code/libmdc/ http://svn.dulcineatech.com/ http://lists.dulcineatech.com/ Michael David Crawford, Process Architect Dulcinea Technologies Corporation Software of Elegance and Beauty firstname.lastname@example.org http://www.dulcineatech.com/mdc/ PO Box 6888 Portland OR 97228 USA +1 (503) 928-7501 Copyright (C) 2005 GoingWare Inc., 2012 Michael David Crawford. Distributed under the terms of Boost Software License - Version 1.0, as stated in the accompanying file LICENSE_1_0.txt. If you did not receive that file, you may read it on the World Wide Web at: http://www.boost.org/LICENSE_1_0.txt Please report license violations via eMail to Mike Crawford at email@example.com ACHTUNG ALLES LOOKENSPEEPERS!!! The Boost Software License, Version 1.0 is *quite* similar to the MIT License, also known as the X Consortium License, the X11 License or the X Window License. But the two licenses are *NOT* the same, in fact there are *many* significant differences between the two! READ THEM OR WEEP. SAY WHAT? libmdc is a set of memory management, automated testing, debugging and utility classes, as well as GNU Make-style Makefiles that you will find useful for most C++ projects. Everything is in the namespace "mdc". WHAT'S NEW? 2012-06-22 - libmdc's homepage has been moved from GoingWare, Inc.'s old website to Dulcinea Technologies Corporation's site. - The Copyright originally held by GoingWare Inc. is now assigned to Michael David Crawford. - The user can choose either at compile time or by editing the top-level Makefile which ISO C++ or C Language Standard Specification to comply with. Thus more-modern compilers may benefit from such language features as c99's "restricted" keyword, while at the same time libmdc remains compatible with older tools that don't know about restricted pointers. - Built and tested with a wider variety of compilers on a wider variety of operating systems, for example with the LLVM toolchain, as well as on Haiku (http://www.haiku-os.org/), BeOS 5 Pro and Windows XP. The 2005 release only supported g++ on Mac OS X and Linux. PREREQUISITES There aren't any dependencies on anything outside this directory except for; * A *Reasonably* ISO/IEC 14882 Standards-Compliant C++ Compiler JTC1/SC22/WG21 - The C++ Standards Committe http://www.open-std.org/JTC1/SC22/WG21/ Strict Standards Compliance is *not* required, but many tools are *still* in widespread use despite being *completely* borked. The C++ Programming Language (Thid Edition and Special Edition) by Bjarne Stroustrup http://www2.research.att.com/~bs/3rd.html The Annotated C++ Reference Manual by Margaret A. Ellis and Bjarne Stroustrup http://www2.research.att.com/~bs/arm.html C++ Frequently Asked Questions http://www.parashift.com/c++-faq-lite/ C++ FAQs, 2nd Edition by Marshall P. Cline, Greg Lomow, Mike Girou http://www.informit.com/store/product.aspx?isbn=0201309831 Information technology - Programming languages - C++ ISO/IEC 14882:2011 http://www.iso.org/iso/catalogue_detail.htm?csnumber=50372 Programming languages - C++ ISO/IEC 14882:2003 (Withdrawn) http://www.iso.org/iso/catalogue_detail.htm?csnumber=25845 Programming languages - C++ ISO/EIC 14882:1998 (Withdrawn) http://www.iso.org/iso/catalogue_detail.htm?csnumber=25845 * The C++ Standard Library http://www.cplusplus.com/reference/ * The Standard Template Library http://www.sgi.com/tech/stl/ * The Boost C++ Libraries http://www.boost.org/ * The C Standard Library http://www.acm.uiuc.edu/webmonkeys/book/c_guide/ * GNU Make http://www.gnu.org/software/make/ * A Command Interpreter that is compliant with IEEE Std 1003.1-2008, more commonly known as the Bourne Shell or POSIX Shell http://pubs.opengroup.org/onlinepubs/007904875/utilities/sh.html * The CPPUnit Unit Testing Framework http://sourceforge.net/apps/mediawiki/cppunit/index.php?title=Main_Page To build libmdc's executables, just type: $ make To build then run the the unit tests as well as other automated tests: $ make test There is no "make install" yet. The library so far contains: CPPUnit.mk, CPPUnit.t.mk Sub-makefiles to make it a lot easier to build CPPUnit unit tests with GNU make. valid_ptr non-owning smart pointer; forbids NULL pointers. legal_addr pointer debugging, best used with valgrind, purify or spotlight. null_ptr_checker throws an exception when given a NULL pointer. null_ptr_exception The exception it throws. mdc_assert Debugging macro, aborts or drops into debugger when its assertion evaluates to false. This is used instead of the standard library assert so it may be separately disabled. Assertions are enabled by default, for release builds, #define MDC_NO_ASSERT 1 or pass -DMDC_NO_ASSERT=1 to the C++ compiler. assertion_failed meant for testing failed assertions in unit tests. You can configure mdc_assert to throw this exception with #define MDC_ASSERTION_EXCEPTION 1 errno_exception on POSIX systems, throw this exception after a system call fails so that the catcher can print a good error message string_invariant The beginning of class invariant assertions for the Standard Library valid_ptr is a smart pointer like auto_ptr, scoped_ptr or shared_ptr, except that it doesn't take ownership of the pointer it holds. Instead, construct a valid_ptr from a pointer that your class or function is given to use, but not manage. It will throw a null_ptr_exception and optionally assert if the pointer is ever NULL. Besides validating the pointer it is given, valid_ptrs serve as documentation to help make ownership issues clear. Using valid_ptrs as class member variables indicates that the pointers are used by, but not owned by the class. Similarly, declaring them as function parameters indicates that the pointers passed in cannot be NULL, and again that ownership of them is not captured by the receiving function. Use either scoped_ptr, shared_ptr or auto_ptr for situations where pointer ownership is required. Which one to use depends on the requirements of each situation. There is sample code too: the tests. There are unit tests for most of the classes that use the CPPUnit automated test framework. There is also a simple program called HeaderCheck that I used to debug some problems with my header files while I was first writing valid_ptr.h. CPPUnit does some extreme macro and template magic, so HeaderCheck serves as a simpler testbed. Enjoy! -- Mike