17f2fe78bSCy Schubert /* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
27f2fe78bSCy Schubert /* lib/krad/t_code.c - RADIUS code table test program */
37f2fe78bSCy Schubert /*
47f2fe78bSCy Schubert * Copyright 2013 Red Hat, Inc. All rights reserved.
57f2fe78bSCy Schubert *
67f2fe78bSCy Schubert * Redistribution and use in source and binary forms, with or without
77f2fe78bSCy Schubert * modification, are permitted provided that the following conditions are met:
87f2fe78bSCy Schubert *
97f2fe78bSCy Schubert * 1. Redistributions of source code must retain the above copyright
107f2fe78bSCy Schubert * notice, this list of conditions and the following disclaimer.
117f2fe78bSCy Schubert *
127f2fe78bSCy Schubert * 2. Redistributions in binary form must reproduce the above copyright
137f2fe78bSCy Schubert * notice, this list of conditions and the following disclaimer in
147f2fe78bSCy Schubert * the documentation and/or other materials provided with the
157f2fe78bSCy Schubert * distribution.
167f2fe78bSCy Schubert *
177f2fe78bSCy Schubert * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
187f2fe78bSCy Schubert * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
197f2fe78bSCy Schubert * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
207f2fe78bSCy Schubert * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
217f2fe78bSCy Schubert * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
227f2fe78bSCy Schubert * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
237f2fe78bSCy Schubert * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
247f2fe78bSCy Schubert * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
257f2fe78bSCy Schubert * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
267f2fe78bSCy Schubert * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
277f2fe78bSCy Schubert * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
287f2fe78bSCy Schubert */
297f2fe78bSCy Schubert
307f2fe78bSCy Schubert #include "t_test.h"
317f2fe78bSCy Schubert
327f2fe78bSCy Schubert int
main(void)33*f1c4c3daSCy Schubert main(void)
347f2fe78bSCy Schubert {
357f2fe78bSCy Schubert const char *tmp;
367f2fe78bSCy Schubert
377f2fe78bSCy Schubert insist(krad_code_name2num("Access-Request") == 1);
387f2fe78bSCy Schubert insist(krad_code_name2num("Access-Accept") == 2);
397f2fe78bSCy Schubert insist(krad_code_name2num("Access-Reject") == 3);
407f2fe78bSCy Schubert
417f2fe78bSCy Schubert tmp = krad_code_num2name(1);
427f2fe78bSCy Schubert insist(tmp != NULL);
437f2fe78bSCy Schubert insist(strcmp(tmp, "Access-Request") == 0);
447f2fe78bSCy Schubert
457f2fe78bSCy Schubert tmp = krad_code_num2name(2);
467f2fe78bSCy Schubert insist(tmp != NULL);
477f2fe78bSCy Schubert insist(strcmp(tmp, "Access-Accept") == 0);
487f2fe78bSCy Schubert
497f2fe78bSCy Schubert tmp = krad_code_num2name(3);
507f2fe78bSCy Schubert insist(tmp != NULL);
517f2fe78bSCy Schubert insist(strcmp(tmp, "Access-Reject") == 0);
527f2fe78bSCy Schubert
537f2fe78bSCy Schubert return 0;
547f2fe78bSCy Schubert }
55