1 /* $NetBSD: check-template.c,v 1.1.1.1 2011/04/13 18:14:40 elric Exp $ */
4 * Copyright (c) 1999 - 2005 Kungliga Tekniska Högskolan
5 * (Royal Institute of Technology, Stockholm, Sweden).
8 * Portions Copyright (c) 2009 Apple Inc. All rights reserved.
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
21 * 3. Neither the name of the Institute nor the names of its contributors
22 * may be used to endorse or promote products derived from this software
23 * without specific prior written permission.
25 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
26 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
43 #include <krb5/roken.h>
45 #include <krb5/asn1-common.h>
46 #include <krb5/asn1_err.h>
48 #include <test_asn1.h>
50 #include "check-common.h"
53 cmp_dummy (void *a
, void *b
)
61 struct test_case tests
[] = {
66 "\x30\x07\x30\x05\xa0\x03\x02\x01\x00",
69 "\x30\x0e\x30\x05\xa0\x03\x02\x01\x00\x30\x05\xa0\x03\x02\x01\x01",
73 int ret
= 0, ntests
= sizeof(tests
) / sizeof(*tests
);
74 TESTSeqOfSeq c0
, c1
, c2
;
75 struct TESTSeqOfSeq_val i
[2];
92 ret
+= generic_test (tests
, ntests
, sizeof(TESTSeqOfSeq
),
93 (generic_encode
)encode_TESTSeqOfSeq
,
94 (generic_length
)length_TESTSeqOfSeq
,
95 (generic_decode
)decode_TESTSeqOfSeq
,
96 (generic_free
)free_TESTSeqOfSeq
,
105 struct test_case tests
[] = {
110 "\x30\x09\x30\x07\xa0\x05\x1b\x03\x65\x74\x74",
113 "\x30\x13\x30\x07\xa0\x05\x1b\x03\x65\x74\x74\x30\x08\xa0"
114 "\x06\x1b\x04\x74\x76\x61\x61",
118 int ret
= 0, ntests
= sizeof(tests
) / sizeof(*tests
);
119 TESTSeqOfSeq2 c0
, c1
, c2
;
120 struct TESTSeqOfSeq2_val i
[2];
123 i
[1].string
= "tvaa";
137 ret
+= generic_test (tests
, ntests
, sizeof(TESTSeqOfSeq2
),
138 (generic_encode
)encode_TESTSeqOfSeq2
,
139 (generic_length
)length_TESTSeqOfSeq2
,
140 (generic_decode
)decode_TESTSeqOfSeq2
,
141 (generic_free
)free_TESTSeqOfSeq2
,
150 struct test_case tests
[] = {
155 "\x30\x07\x30\x05\x1b\x03\x66\x6f\x6f",
158 "\x30\x0c\x30\x0a\x1b\x03\x66\x6f\x6f\x1b\x03\x62\x61\x72",
162 int ret
= 0, ntests
= sizeof(tests
) / sizeof(*tests
);
163 TESTSeqOf2 c0
, c1
, c2
;
164 heim_general_string i
[2];
169 c0
.strings
.val
= NULL
;
181 ret
+= generic_test (tests
, ntests
, sizeof(TESTSeqOf2
),
182 (generic_encode
)encode_TESTSeqOf2
,
183 (generic_length
)length_TESTSeqOf2
,
184 (generic_decode
)decode_TESTSeqOf2
,
185 (generic_free
)free_TESTSeqOf2
,
194 struct test_case tests
[] = {
202 "\x30\x07\x30\x05\x1b\x03\x66\x6f\x6f",
205 "\x30\x0c\x30\x0a\x1b\x03\x66\x6f\x6f\x1b\x03\x62\x61\x72",
209 int ret
= 0, ntests
= sizeof(tests
) / sizeof(*tests
);
210 TESTSeqOf3 c0
, c1
, c2
, c3
;
211 struct TESTSeqOf3_strings s1
, s2
, s3
;
212 heim_general_string i
[2];
235 ret
+= generic_test (tests
, ntests
, sizeof(TESTSeqOf3
),
236 (generic_encode
)encode_TESTSeqOf3
,
237 (generic_length
)length_TESTSeqOf3
,
238 (generic_decode
)decode_TESTSeqOf3
,
239 (generic_free
)free_TESTSeqOf3
,
247 main(int argc
, char **argv
)
251 ret
+= test_seqofseq();
252 ret
+= test_seqofseq2();
253 ret
+= test_seqof2();
254 ret
+= test_seqof3();