README revision 4c6011bfcf29cd75d6af86f192d709221f4d5d3a
3860N/A# The contents of this file are subject to the terms of the Common Development and
3860N/A# Distribution License (the License). You may not use this file except in compliance with the
3860N/A# License.
3860N/A#
3860N/A# You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
3860N/A# specific language governing permission and limitations under the License.
3860N/A#
3860N/A# When distributing Covered Software, include this CDDL Header Notice in each file and include
3860N/A# the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
3860N/A# Header, with the fields enclosed by brackets [] replaced by your own identifying
3860N/A# information: "Portions copyright [year] [name of copyright owner]".
3860N/A#
3860N/A# Copyright 2015 ForgeRock AS.
3860N/A
3860N/A
3860N/AThis directory contains the unit tests for OpenAM Web Policy Agent.
3860N/A
3860N/ATests are placed in C source files and will look something like the following.
3860N/ALet us assume this is the file test_blah.c:
3860N/A
3860N/A
3860N/A
3860N/A
3860N/A#include <relevant-headers.h>
3860N/A
3860N/A/**
3860N/A * Test the blah functionality.
3860N/A */
3860N/Avoid test_blah1(void** state) {
3860N/A
3860N/A // avoids "state not used" messages
3860N/A (void)state;
3860N/A
3860N/A assert_int_equal(AM_OK, AM_OK);
3860N/A
3860N/A // etc.
3860N/A}
3860N/A
3860N/Avoid test_blah2(void** state) {
3860N/A
3860N/A // etc. etc.
3860N/A}
3860N/A
3860N/A
3968N/AMake target "test_includes", which is a part of a global "tests" target, extracts
3860N/Aall of the test method prototypes from each of the test files and creates "tests.h"
3860N/Aheader file. The same target automatically creates "struct CMUnitTest tests[]" object
3860N/Ato be used inside test_MAIN cmocka_run_group_tests().
3860N/A
3860N/AResulting test executable "test" is available under "build" directory.
3860N/A