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