
This folder is part of the C/C++ Programming Tools lectures, themselves
part of the Programming III course.

This is the testing example shown in lecture 1. It's a short extension to 
the example in lecture 1. Go back to that README for more info.

It is a a simple multi-module project comprising a list module (list.c and
list.h), a main program (mainprog.c) and a set of definitions in defns.h
  
  Testing inside Make
  ==================================================================
  
  - Make allows you to run commands as part of the targets. This is a quite
    powerful feature, that can be used (among many things) to run your own
    testing functions. Add this target to the Makefile:

      test: testlist
        ./testlist
  	
  - Calling the target 'test' will compile and run the tests.
  
    $ make tests

    However, Make doesn't have any testing functionality per se, so you'll
    have to rely on your own printf's to know if something went wrong (for
    example, print 'ok' or 'fail', together with some info about the test).
  
  
  Testing inside CMake
  ==================================================================
  
  - Unlike Make, CMake does incorporate specialised functions for test
    control. Start by enabling them at the beginning of your CMakeLists.txt:

    enable_testing()

  - Use the function add_test() to add as many test targets as you like.
    You can set the pass/fail conditions separately for each test (by
    default based on whatever the test sends to stdout). For example:

      add_test(myTest testlist)
      set_tests_properties(myTest PROPERTIES FAIL_REGULAR_EXPRESSION "fail")

  - You can use CMake macros to avoid unnecessary typing.

  - After CMake-ing, you can run 'make test' and it will run all your tests
    and give you a test report including real-time progress, total
    execution time and failed tests.
  

  (C) Duncan C. White, 2014
	    Pedro A.M. Mediano, 2015
