/*
 * tests.h
 *
 *  Created on: Jul 25, 2017
 *      Author: spinalvm
 */

#ifndef TESTS_H_
#define TESTS_H_


/* Common demo includes. */
#include "blocktim.h"
#include "countsem.h"
#include "recmutex.h"


#define CHECK_PERIOD_MS 3000
#define CHECK_COUNT 3


void createTests(){
	vCreateBlockTimeTasks();
	vStartCountingSemaphoreTasks();
	vStartRecursiveMutexTasks();
}

unsigned long checkTests(){
	unsigned long ulErrorFound = pdFALSE;

	/* Check all the demo and test tasks to ensure that they are all still
	running, and that none have detected an error. */

	if( xAreBlockTimeTestTasksStillRunning() != pdPASS )
	{
		bsp_putString("Error in block time test tasks \r\n");
		ulErrorFound |= ( 0x01UL << 1UL );
	}

	if( xAreCountingSemaphoreTasksStillRunning() != pdPASS )
	{
		bsp_putString("Error in counting semaphore tasks \r\n");
		ulErrorFound |= ( 0x01UL << 2UL );
	}

	if( xAreRecursiveMutexTasksStillRunning() != pdPASS )
	{
		bsp_putString("Error in recursive mutex tasks \r\n");
		ulErrorFound |= ( 0x01UL << 3UL );
	}

	return ulErrorFound;
}

#endif /* TESTS_H_ */
