eui64_ntoa_test.c revision 129759
177298Sobrien/*
277298Sobrien * Copyright 2004 The Aerospace Corporation.  All rights reserved.
377298Sobrien *
477298Sobrien * Redistribution and use in source and binary forms, with or without
589857Sobrien * modification, are permitted provided that the following conditions
677298Sobrien * are met:
789857Sobrien *
877298Sobrien * 1.  Redistributions of source code must retain the above copyright
977298Sobrien *     notice, this list of conditions, and the following disclaimer.
1077298Sobrien * 2.  Redistributions in binary form must reproduce the above copyright
1177298Sobrien *     notice, this list of conditions, and the following disclaimer in the
1289857Sobrien *     documentation and/or other materials provided with the distribution.
1377298Sobrien * 3.  The name of The Aerospace Corporation may not be used to endorse or
1477298Sobrien *     promote products derived from this software.
1577298Sobrien *
1677298Sobrien * THIS SOFTWARE IS PROVIDED BY THE AEROSPACE CORPORATION "AS IS" AND
1777298Sobrien * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1889857Sobrien * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1977298Sobrien * ARE DISCLAIMED.  IN NO EVENT SHALL THE AEROSPACE CORPORATION BE LIABLE
2077298Sobrien * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2177298Sobrien * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2277298Sobrien * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2377298Sobrien * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2477298Sobrien * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2577298Sobrien * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2677298Sobrien * SUCH DAMAGE.
2777298Sobrien *
2877298Sobrien * $FreeBSD: head/tools/regression/lib/libc/net/test-eui64_ntoa.c 129759 2004-05-26 22:58:06Z brooks $
2977298Sobrien */
3077298Sobrien
3177298Sobrien#include <sys/types.h>
3277298Sobrien#include <sys/eui64.h>
3377298Sobrien#include <stdio.h>
3477298Sobrien#include <string.h>
3577298Sobrien
3677298Sobrien#include "test-eui64.h"
3777298Sobrien
3877298Sobrienint
3977298Sobrienmain(int argc, char **argv)
4077298Sobrien{
4177298Sobrien	char a[EUI64_SIZ];
4277298Sobrien
4377298Sobrien	if (eui64_ntoa(&test_eui64_id, a, sizeof(a)) == 0 &&
4477298Sobrien	    strcmp(a, test_eui64_id_ascii) == 0) {
4577298Sobrien		printf("PASS: eui64_ntoa\n");
4677298Sobrien		return (0);
4777298Sobrien	}
4877298Sobrien	printf("a = '%s'\n", a);
49
50	printf("FAIL: eui64_ntoa\n");
51	return (0);
52}
53/*
54 * Copyright 2004 The Aerospace Corporation.  All rights reserved.
55 *
56 * Redistribution and use in source and binary forms, with or without
57 * modification, are permitted provided that the following conditions
58 * are met:
59 *
60 * 1.  Redistributions of source code must retain the above copyright
61 *     notice, this list of conditions, and the following disclaimer.
62 * 2.  Redistributions in binary form must reproduce the above copyright
63 *     notice, this list of conditions, and the following disclaimer in the
64 *     documentation and/or other materials provided with the distribution.
65 * 3.  The name of The Aerospace Corporation may not be used to endorse or
66 *     promote products derived from this software.
67 *
68 * THIS SOFTWARE IS PROVIDED BY THE AEROSPACE CORPORATION "AS IS" AND
69 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
70 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
71 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AEROSPACE CORPORATION BE LIABLE
72 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
73 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
74 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
75 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
76 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
77 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
78 * SUCH DAMAGE.
79 *
80 * $FreeBSD: head/tools/regression/lib/libc/net/test-eui64_ntoa.c 129759 2004-05-26 22:58:06Z brooks $
81 */
82
83#include <sys/types.h>
84#include <sys/eui64.h>
85#include <stdio.h>
86#include <string.h>
87
88#include "test-eui64.h"
89
90int
91main(int argc, char **argv)
92{
93	char a[EUI64_SIZ];
94
95	if (eui64_ntoa(&test_eui64_id, a, sizeof(a)) == 0 &&
96	    strcmp(a, test_eui64_id_ascii) == 0) {
97		printf("PASS: eui64_ntoa\n");
98		return (0);
99	}
100	printf("a = '%s'\n", a);
101
102	printf("FAIL: eui64_ntoa\n");
103	return (0);
104}
105