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