uCUnit Logo


Home | Getting Started | Documentation | Related Sites

Customizing Area

Macros and defines in the customzing area have to be adapted for your hardware. The macros in the customzing area are used for hardware abstraction. You have to provide at least these functions for a minimal test system.


Constants

UCUNIT_MAX_TRACEPOINTS <max. number of tracepoints>

Max. number of tracepoints. This may depend on your application or limited by your RAM.

Verbose Mode.

UCUNIT_MODE_SILENT Checks are performed silently.
UCUNIT_MODE_NORMAL Only checks that fail are displayes
UCUNIT_MODE_VERBOSE Passed and failed checks are displayed


UCUNIT_WriteString(msg)

Encapsulates a function which is called for writing a message string to the host computer.

msg Message which shall be written.

Note:
Implement a function to write an integer to a host computer.
For most microcontrollers a special implementation of printf is available for writing to a serial device or network. In some cases you will have also to implement a putch(char c) function.


UCUNIT_WriteInt(n)

Encapsulates a function which is called for writing an integer to the host computer.

n Integer number which shall be written

Note:
Implement a function to write an integer to a host computer.
For most microcontrollers a special implementation of printf is available for writing to a serial device or network. In some cases you will have also to implement a putch(char c) function.


UCUNIT_Safestate()

Encapsulates a function which is called for putting the hardware to a safe state.

Note:
Implement a function to put your hardware into a safe state.
For example, imagine a motor controller application: 1. Stop the motor 2. Power brake 3. Hold the brake 4. Switch warning lamp on 5. Wait for acknowledge ...


UCUNIT_Recover()

Encapsulates a function which is called for recovering the hardware from a safe state.

Note:
Implement a function to recover your hardware from a safe state.
For example, imagine our motor controller application: 1. Acknowledge the error with a key switch 2. Switch warning lamp off 3. Reboot ...


UCUNIT_Init()

Encapsulates a function which is called for initializing the hardware.

Note:
Implement a function to initialize your microcontroller hardware. You need at least to initialize the communication device for transmitting your results to a host computer.

UCUNIT_Shutdown()

Encapsulates a function which is called to stop the tests if a checklist fails.

Note:
Implement a function to stop the execution of the tests.

Checklist Macros


UCUNIT_ChecklistBegin(action)

Begin of a checklist. You have to tell what action shall be taken if a check fails.

action Action to take. This can be:

Note:
A checklist must be finished with UCUNIT_EndChecklist()

UCUNIT_ChecklistEnd()

End of a checklist. If the action was UCUNIT_ACTION_SHUTDOWN the system will shutdown.

Note:
A checklist must begin with UCUNIT_ChecklistBegin(action)

UCUNIT_Check(condition, msg, args)

Checks a condition and prints a message.

msg Message to write.
args Argument list as string

Note:
Basic check. This macro is used by all higher level checks.

UCUNIT_CheckIsEqual(expected,actual)

Checks that actual value equals the expected value.

expected Expected value. actual Actual value.

Note:
This macro uses UCUNIT_Check(condition, msg, args).

UCUNIT_CheckIsNull(pointer)

Checks that a pointer is NULL.

pointer Pointer to check.

Note:
This macro uses UCUNIT_Check(condition, msg, args).

UCUNIT_CheckIsNotNull(pointer)

Checks that a pointer is not NULL.

pointer Pointer to check.

Note:
This macro uses UCUNIT_Check(condition, msg, args).

UCUNIT_CheckIsInRange(value, lower, upper)

Checks if a value is between lower and upper bounds (inclusive) Mathematical: lower <= value <= upper

value Value to check.
lower Lower bound.
upper Upper bound.

Note:
This macro uses UCUNIT_Check(condition, msg, args).

UCUNIT_CheckIs8Bit(value)

Checks if a value fits into 8-bit.

value Value to check.

Note:
This macro uses UCUNIT_Check(condition, msg, args).

UCUNIT_CheckIs16Bit(value)

Checks if a value fits into 16-bit.

value Value to check.

Note:
This macro uses UCUNIT_Check(condition, msg, args).

UCUNIT_CheckIs32Bit(value)

Checks if a value fits into 32-bit.

value Value to check.

Note:
This macro uses UCUNIT_Check(condition, msg, args).

UCUNIT_CheckIsBitSet(value, bitno)

Checks if a bit is set in value.

value Value to check.
bitno Bit number. The least significant bit is 0.

Note:
This macro uses UCUNIT_Check(condition, msg, args).

UCUNIT_CheckIsBitClear(value, bitno)

Checks if a bit is not set in value.

value Value to check.
bitno Bit number. The least significant bit is 0.

Note:
This macro uses UCUNIT_Check(condition, msg, args).

Testcase Macros


UCUNIT_TestcaseBegin(name)

Marks the beginning of a test case and resets the test case statistic.

name Name of the test case.

Note:
This macro uses UCUNIT_WriteString(msg) to print the name.

UCUNIT_TestcaseEnd()

Marks the end of a test case and calculates the test case statistics.

Note:
This macro uses UCUNIT_WriteString(msg) to print the result.

Code Coverage Macros


UCUNIT_Tracepoint(index)

Marks a trace point. If a trace point is executed, its coverage state switches from 0 to the line number. If a trace point was never executed, the state remains 0.

index Index of the tracepoint.

Note:
This macro fails if index>UCUNIT_MAX_TRACEPOINTS.

UCUNIT_ResetTracepointCoverage()

Resets the trace point coverage state to 0.

index Index of the trace point.

Note:
This macro fails if index>UCUNIT_MAX_TRACEPOINTS.

Testsuite Macros


UCUNIT_WriteSummary()

Writes the test suite summary.

Note:
This macro uses UCUNIT_WriteString(msg) and UCUNIT_WriteInt(n) to write the summary.


Impressum  |  Datenschutz  |  Terms of use  |  Copyright (C) 2008 Sven Stefan Krauß. Last site update: 14-Aug-2008