1272343Sngie/*	$NetBSD: t_sdp_put.c,v 1.3 2011/04/16 07:32:27 plunky Exp $	*/
2272343Sngie
3272343Sngie/*-
4272343Sngie * Copyright (c) 2011 The NetBSD Foundation, Inc.
5272343Sngie * All rights reserved.
6272343Sngie *
7272343Sngie * This code is derived from software contributed to The NetBSD Foundation
8272343Sngie * by Iain Hibbert.
9272343Sngie *
10272343Sngie * Redistribution and use in source and binary forms, with or without
11272343Sngie * modification, are permitted provided that the following conditions
12272343Sngie * are met:
13272343Sngie * 1. Redistributions of source code must retain the above copyright
14272343Sngie *    notice, this list of conditions and the following disclaimer.
15272343Sngie * 2. Redistributions in binary form must reproduce the above copyright
16272343Sngie *    notice, this list of conditions and the following disclaimer in the
17272343Sngie *    documentation and/or other materials provided with the distribution.
18272343Sngie *
19272343Sngie * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20272343Sngie * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21272343Sngie * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22272343Sngie * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23272343Sngie * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24272343Sngie * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25272343Sngie * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26272343Sngie * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27272343Sngie * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28272343Sngie * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29272343Sngie * POSSIBILITY OF SUCH DAMAGE.
30272343Sngie */
31272343Sngie
32272343Sngie#include <atf-c.h>
33272343Sngie
34272343Sngie#include <limits.h>
35272343Sngie#include <sdp.h>
36272343Sngie#include <string.h>
37272343Sngie
38272343SngieATF_TC(check_sdp_put_data);
39272343Sngie
40272343SngieATF_TC_HEAD(check_sdp_put_data, tc)
41272343Sngie{
42272343Sngie
43272343Sngie	atf_tc_set_md_var(tc, "descr", "Test sdp_put_data results");
44272343Sngie}
45272343Sngie
46272343SngieATF_TC_BODY(check_sdp_put_data, tc)
47272343Sngie{
48272343Sngie	uint8_t buf[256];
49272343Sngie	sdp_data_t test = { buf, buf + sizeof(buf) };
50272343Sngie	uint8_t data[] = {
51272343Sngie		0x35, 0x05,		// seq8(5)
52272343Sngie		0x08, 0x00,		//   uint8	0x00
53272343Sngie		0x09, 0x12, 0x34,	//   uint16	0x1234
54272343Sngie	};
55272343Sngie	sdp_data_t value = { data, data + sizeof(data) };
56272343Sngie
57272343Sngie	ATF_REQUIRE(sdp_put_data(&test, &value));
58272343Sngie	test.end = test.next;
59272343Sngie	test.next = buf;
60272343Sngie
61272343Sngie	const uint8_t expect[] = {
62272343Sngie		0x35, 0x05,		// seq8(5)
63272343Sngie		0x08, 0x00,		//   uint8	0x00
64272343Sngie		0x09, 0x12, 0x34,	//   uint16	0x1234
65272343Sngie	};
66272343Sngie
67272343Sngie	ATF_REQUIRE_EQ(test.end - test.next, sizeof(expect));
68272343Sngie	ATF_CHECK(memcmp(expect, test.next, sizeof(expect)) == 0);
69272343Sngie}
70272343Sngie
71272343SngieATF_TC(check_sdp_put_attr);
72272343Sngie
73272343SngieATF_TC_HEAD(check_sdp_put_attr, tc)
74272343Sngie{
75272343Sngie
76272343Sngie	atf_tc_set_md_var(tc, "descr", "Test sdp_put_attr results");
77272343Sngie}
78272343Sngie
79272343SngieATF_TC_BODY(check_sdp_put_attr, tc)
80272343Sngie{
81272343Sngie	uint8_t buf[256];
82272343Sngie	sdp_data_t test = { buf, buf + sizeof(buf) };
83272343Sngie	uint8_t data[] = {
84272343Sngie		0x00,			// nil
85272343Sngie		0x19, 0x33, 0x44,	// uuid16	0x3344
86272343Sngie	};
87272343Sngie	sdp_data_t value = { data, data + sizeof(data) };
88272343Sngie
89272343Sngie	ATF_REQUIRE_EQ(sdp_put_attr(&test, 0xabcd, &value), false);
90272343Sngie	value.next += 1; // skip "nil"
91272343Sngie	ATF_REQUIRE(sdp_put_attr(&test, 0x1337, &value));
92272343Sngie	test.end = test.next;
93272343Sngie	test.next = buf;
94272343Sngie
95272343Sngie	const uint8_t expect[] = {
96272343Sngie		0x09, 0x13, 0x37,	// uint16	0x1337
97272343Sngie		0x19, 0x33, 0x44,	// uuid16	0x3344
98272343Sngie	};
99272343Sngie
100272343Sngie	ATF_REQUIRE_EQ(test.end - test.next, sizeof(expect));
101272343Sngie	ATF_CHECK(memcmp(expect, test.next, sizeof(expect)) == 0);
102272343Sngie}
103272343Sngie
104272343SngieATF_TC(check_sdp_put_uuid);
105272343Sngie
106272343SngieATF_TC_HEAD(check_sdp_put_uuid, tc)
107272343Sngie{
108272343Sngie
109272343Sngie	atf_tc_set_md_var(tc, "descr", "Test sdp_put_uuid results");
110272343Sngie}
111272343Sngie
112272343SngieATF_TC_BODY(check_sdp_put_uuid, tc)
113272343Sngie{
114272343Sngie	uint8_t buf[256];
115272343Sngie	sdp_data_t test = { buf, buf + sizeof(buf) };
116272343Sngie	const uuid_t u16 = {
117272343Sngie		0x00001234,
118272343Sngie		0x0000,
119272343Sngie		0x1000,
120272343Sngie		0x80,
121272343Sngie		0x00,
122272343Sngie		{ 0x00, 0x80, 0x5f, 0x9b, 0x34, 0xfb }
123272343Sngie	};
124272343Sngie	const uuid_t u32 = {
125272343Sngie		0x12345678,
126272343Sngie		0x0000,
127272343Sngie		0x1000,
128272343Sngie		0x80,
129272343Sngie		0x00,
130272343Sngie		{ 0x00, 0x80, 0x5f, 0x9b, 0x34, 0xfb }
131272343Sngie	};
132272343Sngie	const uuid_t u128 = {
133272343Sngie		0x00112233,
134272343Sngie		0x4444,
135272343Sngie		0x5555,
136272343Sngie		0x66,
137272343Sngie		0x77,
138272343Sngie		{ 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd }
139272343Sngie	};
140272343Sngie
141272343Sngie	ATF_REQUIRE(sdp_put_uuid(&test, &u16));
142272343Sngie	ATF_REQUIRE(sdp_put_uuid(&test, &u32));
143272343Sngie	ATF_REQUIRE(sdp_put_uuid(&test, &u128));
144272343Sngie	test.end = test.next;
145272343Sngie	test.next = buf;
146272343Sngie
147272343Sngie	const uint8_t expect[] = {
148272343Sngie		0x19, 0x12, 0x34,	// uuid16	0x1234
149272343Sngie		0x1a, 0x12, 0x34, 0x56, // uuid32	0x12345678
150272343Sngie		0x78,
151272343Sngie		0x1c, 0x00, 0x11, 0x22,	// uuid128	00112233-4444-5555-6677-8899aabbccdd
152272343Sngie		0x33, 0x44, 0x44, 0x55,
153272343Sngie		0x55, 0x66, 0x77, 0x88,
154272343Sngie		0x99, 0xaa, 0xbb, 0xcc,
155272343Sngie		0xdd,
156272343Sngie	};
157272343Sngie
158272343Sngie	ATF_REQUIRE_EQ(test.end - test.next, sizeof(expect));
159272343Sngie	ATF_CHECK(memcmp(expect, test.next, sizeof(expect)) == 0);
160272343Sngie}
161272343Sngie
162272343SngieATF_TC(check_sdp_put_uuid16);
163272343Sngie
164272343SngieATF_TC_HEAD(check_sdp_put_uuid16, tc)
165272343Sngie{
166272343Sngie
167272343Sngie	atf_tc_set_md_var(tc, "descr", "Test sdp_put_uuid16 results");
168272343Sngie}
169272343Sngie
170272343SngieATF_TC_BODY(check_sdp_put_uuid16, tc)
171272343Sngie{
172272343Sngie	uint8_t buf[256];
173272343Sngie	sdp_data_t test = { buf, buf + sizeof(buf) };
174272343Sngie
175272343Sngie	ATF_REQUIRE(sdp_put_uuid16(&test, 0x4567));
176272343Sngie	test.end = test.next;
177272343Sngie	test.next = buf;
178272343Sngie
179272343Sngie	const uint8_t expect[] = {
180272343Sngie		0x19, 0x45, 0x67,	// uuid16	0x4567
181272343Sngie	};
182272343Sngie
183272343Sngie	ATF_REQUIRE_EQ(test.end - test.next, sizeof(expect));
184272343Sngie	ATF_CHECK(memcmp(expect, test.next, sizeof(expect)) == 0);
185272343Sngie}
186272343Sngie
187272343SngieATF_TC(check_sdp_put_uuid32);
188272343Sngie
189272343SngieATF_TC_HEAD(check_sdp_put_uuid32, tc)
190272343Sngie{
191272343Sngie
192272343Sngie	atf_tc_set_md_var(tc, "descr", "Test sdp_put_uuid32 results");
193272343Sngie}
194272343Sngie
195272343SngieATF_TC_BODY(check_sdp_put_uuid32, tc)
196272343Sngie{
197272343Sngie	uint8_t buf[256];
198272343Sngie	sdp_data_t test = { buf, buf + sizeof(buf) };
199272343Sngie
200272343Sngie	ATF_REQUIRE(sdp_put_uuid32(&test, 0xabcdef00));
201272343Sngie	test.end = test.next;
202272343Sngie	test.next = buf;
203272343Sngie
204272343Sngie	const uint8_t expect[] = {
205272343Sngie		0x1a, 0xab, 0xcd, 0xef, // uuid32	0xabcdef00
206272343Sngie		0x00,
207272343Sngie	};
208272343Sngie
209272343Sngie	ATF_REQUIRE_EQ(test.end - test.next, sizeof(expect));
210272343Sngie	ATF_CHECK(memcmp(expect, test.next, sizeof(expect)) == 0);
211272343Sngie}
212272343Sngie
213272343SngieATF_TC(check_sdp_put_uuid128);
214272343Sngie
215272343SngieATF_TC_HEAD(check_sdp_put_uuid128, tc)
216272343Sngie{
217272343Sngie
218272343Sngie	atf_tc_set_md_var(tc, "descr", "Test sdp_put_uuid128 results");
219272343Sngie}
220272343Sngie
221272343SngieATF_TC_BODY(check_sdp_put_uuid128, tc)
222272343Sngie{
223272343Sngie	uint8_t buf[256];
224272343Sngie	sdp_data_t test = { buf, buf + sizeof(buf) };
225272343Sngie	uuid_t value = {
226272343Sngie		0x00000100,
227272343Sngie		0x0000,
228272343Sngie		0x1000,
229272343Sngie		0x80,
230272343Sngie		0x00,
231272343Sngie		{ 0x00, 0x80, 0x5f, 0x9b, 0x34, 0xfb }
232272343Sngie	};
233272343Sngie
234272343Sngie	ATF_REQUIRE(sdp_put_uuid128(&test, &value));
235272343Sngie	test.end = test.next;
236272343Sngie	test.next = buf;
237272343Sngie
238272343Sngie	const uint8_t expect[] = {
239272343Sngie		0x1c, 0x00, 0x00, 0x01,	// uuid128	0000100-0000-1000-8000-00805f9b34fb
240272343Sngie		0x00, 0x00, 0x00, 0x10,	//			(L2CAP protocol)
241272343Sngie		0x00, 0x80, 0x00, 0x00,
242272343Sngie		0x80, 0x5f, 0x9b, 0x34,
243272343Sngie		0xfb,
244272343Sngie	};
245272343Sngie
246272343Sngie	ATF_REQUIRE_EQ(test.end - test.next, sizeof(expect));
247272343Sngie	ATF_CHECK(memcmp(expect, test.next, sizeof(expect)) == 0);
248272343Sngie}
249272343Sngie
250272343SngieATF_TC(check_sdp_put_bool);
251272343Sngie
252272343SngieATF_TC_HEAD(check_sdp_put_bool, tc)
253272343Sngie{
254272343Sngie
255272343Sngie	atf_tc_set_md_var(tc, "descr", "Test sdp_put_bool results");
256272343Sngie}
257272343Sngie
258272343SngieATF_TC_BODY(check_sdp_put_bool, tc)
259272343Sngie{
260272343Sngie	uint8_t buf[256];
261272343Sngie	sdp_data_t test = { buf, buf + sizeof(buf) };
262272343Sngie
263272343Sngie	ATF_REQUIRE(sdp_put_bool(&test, true));
264272343Sngie	ATF_REQUIRE(sdp_put_bool(&test, false));
265272343Sngie	test.end = test.next;
266272343Sngie	test.next = buf;
267272343Sngie
268272343Sngie	const uint8_t expect[] = {
269272343Sngie		0x28, 0x01,		// bool	true
270272343Sngie		0x28, 0x00,		// bool	false
271272343Sngie	};
272272343Sngie
273272343Sngie	ATF_REQUIRE_EQ(test.end - test.next, sizeof(expect));
274272343Sngie	ATF_CHECK(memcmp(expect, test.next, sizeof(expect)) == 0);
275272343Sngie}
276272343Sngie
277272343SngieATF_TC(check_sdp_put_uint);
278272343Sngie
279272343SngieATF_TC_HEAD(check_sdp_put_uint, tc)
280272343Sngie{
281272343Sngie
282272343Sngie	atf_tc_set_md_var(tc, "descr", "Test sdp_put_uint results");
283272343Sngie}
284272343Sngie
285272343SngieATF_TC_BODY(check_sdp_put_uint, tc)
286272343Sngie{
287272343Sngie	uint8_t buf[256];
288272343Sngie	sdp_data_t test = { buf, buf + sizeof(buf) };
289272343Sngie
290272343Sngie	ATF_REQUIRE(sdp_put_uint(&test, (uintmax_t)0));
291272343Sngie	ATF_REQUIRE(sdp_put_uint(&test, (uintmax_t)UINT8_MAX));
292272343Sngie	ATF_REQUIRE(sdp_put_uint(&test, (uintmax_t)UINT8_MAX + 1));
293272343Sngie	ATF_REQUIRE(sdp_put_uint(&test, (uintmax_t)UINT16_MAX));
294272343Sngie	ATF_REQUIRE(sdp_put_uint(&test, (uintmax_t)UINT16_MAX + 1));
295272343Sngie	ATF_REQUIRE(sdp_put_uint(&test, (uintmax_t)UINT32_MAX));
296272343Sngie	ATF_REQUIRE(sdp_put_uint(&test, (uintmax_t)UINT32_MAX + 1));
297272343Sngie	ATF_REQUIRE(sdp_put_uint(&test, (uintmax_t)UINT64_MAX));
298272343Sngie	test.end = test.next;
299272343Sngie	test.next = buf;
300272343Sngie
301272343Sngie	const uint8_t expect[] = {
302272343Sngie		0x08, 0x00,		// uint8	0x00
303272343Sngie		0x08, 0xff,		// uint8	0xff
304272343Sngie		0x09, 0x01, 0x00,	// uint16	0x0100
305272343Sngie		0x09, 0xff, 0xff,	// uint16	0xffff
306272343Sngie		0x0a, 0x00, 0x01, 0x00,	// uint32	0x00010000
307272343Sngie		0x00,
308272343Sngie		0x0a, 0xff, 0xff, 0xff,	// uint32	0xffffffff
309272343Sngie		0xff,
310272343Sngie		0x0b, 0x00, 0x00, 0x00,	// uint64	0x0000000100000000
311272343Sngie		0x01, 0x00, 0x00, 0x00,
312272343Sngie		0x00,
313272343Sngie		0x0b, 0xff, 0xff, 0xff,	// uint64	0xffffffffffffffff
314272343Sngie		0xff, 0xff, 0xff, 0xff,
315272343Sngie		0xff,
316272343Sngie	};
317272343Sngie
318272343Sngie	ATF_REQUIRE_EQ(test.end - test.next, sizeof(expect));
319272343Sngie	ATF_CHECK(memcmp(expect, test.next, sizeof(expect)) == 0);
320272343Sngie}
321272343Sngie
322272343SngieATF_TC(check_sdp_put_uint8);
323272343Sngie
324272343SngieATF_TC_HEAD(check_sdp_put_uint8, tc)
325272343Sngie{
326272343Sngie
327272343Sngie	atf_tc_set_md_var(tc, "descr", "Test sdp_put_uint8 results");
328272343Sngie}
329272343Sngie
330272343SngieATF_TC_BODY(check_sdp_put_uint8, tc)
331272343Sngie{
332272343Sngie	uint8_t buf[256];
333272343Sngie	sdp_data_t test = { buf, buf + sizeof(buf) };
334272343Sngie
335272343Sngie	ATF_REQUIRE(sdp_put_uint8(&test, (uint8_t)0));
336272343Sngie	ATF_REQUIRE(sdp_put_uint8(&test, (uint8_t)UINT8_MAX));
337272343Sngie	test.end = test.next;
338272343Sngie	test.next = buf;
339272343Sngie
340272343Sngie	const uint8_t expect[] = {
341272343Sngie		0x08, 0x00,		// uint8	0x00
342272343Sngie		0x08, 0xff,		// uint8	0xff
343272343Sngie	};
344272343Sngie
345272343Sngie	ATF_REQUIRE_EQ(test.end - test.next, sizeof(expect));
346272343Sngie	ATF_CHECK(memcmp(expect, test.next, sizeof(expect)) == 0);
347272343Sngie}
348272343Sngie
349272343SngieATF_TC(check_sdp_put_uint16);
350272343Sngie
351272343SngieATF_TC_HEAD(check_sdp_put_uint16, tc)
352272343Sngie{
353272343Sngie
354272343Sngie	atf_tc_set_md_var(tc, "descr", "Test sdp_put_uint16 results");
355272343Sngie}
356272343Sngie
357272343SngieATF_TC_BODY(check_sdp_put_uint16, tc)
358272343Sngie{
359272343Sngie	uint8_t buf[256];
360272343Sngie	sdp_data_t test = { buf, buf + sizeof(buf) };
361272343Sngie
362272343Sngie	ATF_REQUIRE(sdp_put_uint16(&test, (uint16_t)0));
363272343Sngie	ATF_REQUIRE(sdp_put_uint16(&test, (uint16_t)UINT8_MAX));
364272343Sngie	ATF_REQUIRE(sdp_put_uint16(&test, (uint16_t)UINT16_MAX));
365272343Sngie	ATF_REQUIRE(sdp_put_uint16(&test, (uint16_t)0xabcd));
366272343Sngie	test.end = test.next;
367272343Sngie	test.next = buf;
368272343Sngie
369272343Sngie	const uint8_t expect[] = {
370272343Sngie		0x09, 0x00, 0x00,	// uint16	0x0000
371272343Sngie		0x09, 0x00, 0xff,	// uint16	0x00ff
372272343Sngie		0x09, 0xff, 0xff,	// uint16	0xffff
373272343Sngie		0x09, 0xab, 0xcd,	// uint16	0xabcd
374272343Sngie	};
375272343Sngie
376272343Sngie	ATF_REQUIRE_EQ(test.end - test.next, sizeof(expect));
377272343Sngie	ATF_CHECK(memcmp(expect, test.next, sizeof(expect)) == 0);
378272343Sngie}
379272343Sngie
380272343SngieATF_TC(check_sdp_put_uint32);
381272343Sngie
382272343SngieATF_TC_HEAD(check_sdp_put_uint32, tc)
383272343Sngie{
384272343Sngie
385272343Sngie	atf_tc_set_md_var(tc, "descr", "Test sdp_put_uint32 results");
386272343Sngie}
387272343Sngie
388272343SngieATF_TC_BODY(check_sdp_put_uint32, tc)
389272343Sngie{
390272343Sngie	uint8_t buf[256];
391272343Sngie	sdp_data_t test = { buf, buf + sizeof(buf) };
392272343Sngie
393272343Sngie	ATF_REQUIRE(sdp_put_uint32(&test, (uint32_t)0));
394272343Sngie	ATF_REQUIRE(sdp_put_uint32(&test, (uint32_t)UINT8_MAX));
395272343Sngie	ATF_REQUIRE(sdp_put_uint32(&test, (uint32_t)UINT16_MAX));
396272343Sngie	ATF_REQUIRE(sdp_put_uint32(&test, (uint32_t)UINT32_MAX));
397272343Sngie	ATF_REQUIRE(sdp_put_uint32(&test, (uint32_t)0xdeadbeef));
398272343Sngie	test.end = test.next;
399272343Sngie	test.next = buf;
400272343Sngie
401272343Sngie	const uint8_t expect[] = {
402272343Sngie		0x0a, 0x00, 0x00, 0x00,	// uint32	0x00000000
403272343Sngie		0x00,
404272343Sngie		0x0a, 0x00, 0x00, 0x00,	// uint32	0x000000ff
405272343Sngie		0xff,
406272343Sngie		0x0a, 0x00, 0x00, 0xff,	// uint32	0x0000ffff
407272343Sngie		0xff,
408272343Sngie		0x0a, 0xff, 0xff, 0xff,	// uint32	0xffffffff
409272343Sngie		0xff,
410272343Sngie		0x0a, 0xde, 0xad, 0xbe,	// uint32	0xdeadbeef
411272343Sngie		0xef,
412272343Sngie	};
413272343Sngie
414272343Sngie	ATF_REQUIRE_EQ(test.end - test.next, sizeof(expect));
415272343Sngie	ATF_CHECK(memcmp(expect, test.next, sizeof(expect)) == 0);
416272343Sngie}
417272343Sngie
418272343SngieATF_TC(check_sdp_put_uint64);
419272343Sngie
420272343SngieATF_TC_HEAD(check_sdp_put_uint64, tc)
421272343Sngie{
422272343Sngie
423272343Sngie	atf_tc_set_md_var(tc, "descr", "Test sdp_put_uint64 results");
424272343Sngie}
425272343Sngie
426272343SngieATF_TC_BODY(check_sdp_put_uint64, tc)
427272343Sngie{
428272343Sngie	uint8_t buf[256];
429272343Sngie	sdp_data_t test = { buf, buf + sizeof(buf) };
430272343Sngie
431272343Sngie	ATF_REQUIRE(sdp_put_uint64(&test, (uint64_t)0));
432272343Sngie	ATF_REQUIRE(sdp_put_uint64(&test, (uint64_t)UINT8_MAX));
433272343Sngie	ATF_REQUIRE(sdp_put_uint64(&test, (uint64_t)UINT16_MAX));
434272343Sngie	ATF_REQUIRE(sdp_put_uint64(&test, (uint64_t)UINT32_MAX));
435272343Sngie	ATF_REQUIRE(sdp_put_uint64(&test, (uint64_t)UINT64_MAX));
436272343Sngie	ATF_REQUIRE(sdp_put_uint64(&test, (uint64_t)0xc0ffeecafec0ffee));
437272343Sngie	test.end = test.next;
438272343Sngie	test.next = buf;
439272343Sngie
440272343Sngie	const uint8_t expect[] = {
441272343Sngie		0x0b, 0x00, 0x00, 0x00,	// uint64	0x0000000000000000
442272343Sngie		0x00, 0x00, 0x00, 0x00,
443272343Sngie		0x00,
444272343Sngie		0x0b, 0x00, 0x00, 0x00,	// uint64	0x00000000000000ff
445272343Sngie		0x00, 0x00, 0x00, 0x00,
446272343Sngie		0xff,
447272343Sngie		0x0b, 0x00, 0x00, 0x00,	// uint64	0x000000000000ffff
448272343Sngie		0x00, 0x00, 0x00, 0xff,
449272343Sngie		0xff,
450272343Sngie		0x0b, 0x00, 0x00, 0x00,	// uint64	0x00000000ffffffff
451272343Sngie		0x00, 0xff, 0xff, 0xff,
452272343Sngie		0xff,
453272343Sngie		0x0b, 0xff, 0xff, 0xff,	// uint64	0xffffffffffffffff
454272343Sngie		0xff, 0xff, 0xff, 0xff,
455272343Sngie		0xff,
456272343Sngie		0x0b, 0xc0, 0xff, 0xee,	// uint64	0xc0ffeecafec0ffee
457272343Sngie		0xca, 0xfe, 0xc0, 0xff,
458272343Sngie		0xee,
459272343Sngie	};
460272343Sngie
461272343Sngie	ATF_REQUIRE_EQ(test.end - test.next, sizeof(expect));
462272343Sngie	ATF_CHECK(memcmp(expect, test.next, sizeof(expect)) == 0);
463272343Sngie}
464272343Sngie
465272343SngieATF_TC(check_sdp_put_int);
466272343Sngie
467272343SngieATF_TC_HEAD(check_sdp_put_int, tc)
468272343Sngie{
469272343Sngie
470272343Sngie	atf_tc_set_md_var(tc, "descr", "Test sdp_put_int results");
471272343Sngie}
472272343Sngie
473272343SngieATF_TC_BODY(check_sdp_put_int, tc)
474272343Sngie{
475272343Sngie	uint8_t buf[256];
476272343Sngie	sdp_data_t test = { buf, buf + sizeof(buf) };
477272343Sngie
478272343Sngie	ATF_REQUIRE(sdp_put_int(&test, (intmax_t)0));
479272343Sngie	ATF_REQUIRE(sdp_put_int(&test, (intmax_t)INT8_MIN));
480272343Sngie	ATF_REQUIRE(sdp_put_int(&test, (intmax_t)INT8_MAX));
481272343Sngie	ATF_REQUIRE(sdp_put_int(&test, (intmax_t)INT8_MIN - 1));
482272343Sngie	ATF_REQUIRE(sdp_put_int(&test, (intmax_t)INT8_MAX + 1));
483272343Sngie	ATF_REQUIRE(sdp_put_int(&test, (intmax_t)INT16_MIN));
484272343Sngie	ATF_REQUIRE(sdp_put_int(&test, (intmax_t)INT16_MAX));
485272343Sngie	ATF_REQUIRE(sdp_put_int(&test, (intmax_t)INT16_MIN - 1));
486272343Sngie	ATF_REQUIRE(sdp_put_int(&test, (intmax_t)INT16_MAX + 1));
487272343Sngie	ATF_REQUIRE(sdp_put_int(&test, (intmax_t)INT32_MIN));
488272343Sngie	ATF_REQUIRE(sdp_put_int(&test, (intmax_t)INT32_MAX));
489272343Sngie	ATF_REQUIRE(sdp_put_int(&test, (intmax_t)INT32_MIN - 1));
490272343Sngie	ATF_REQUIRE(sdp_put_int(&test, (intmax_t)INT32_MAX + 1));
491272343Sngie	ATF_REQUIRE(sdp_put_int(&test, (intmax_t)INT64_MIN));
492272343Sngie	ATF_REQUIRE(sdp_put_int(&test, (intmax_t)INT64_MAX));
493272343Sngie	test.end = test.next;
494272343Sngie	test.next = buf;
495272343Sngie
496272343Sngie	const uint8_t expect[] = {
497272343Sngie		0x10, 0x00,		// int8		0
498272343Sngie		0x10, 0x80,		// int8		-128
499272343Sngie		0x10, 0x7f,		// int8		127
500272343Sngie		0x11, 0xff, 0x7f,	// int16	-129
501272343Sngie		0x11, 0x00, 0x80,	// int16	128
502272343Sngie		0x11, 0x80, 0x00,	// int16	-32768
503272343Sngie		0x11, 0x7f, 0xff,	// int16	32767
504272343Sngie		0x12, 0xff, 0xff, 0x7f,	// int32	-32769
505272343Sngie		0xff,
506272343Sngie		0x12, 0x00, 0x00, 0x80,	// int32	32768
507272343Sngie		0x00,
508272343Sngie		0x12, 0x80, 0x00, 0x00,	// int32	-2147483648
509272343Sngie		0x00,
510272343Sngie		0x12, 0x7f, 0xff, 0xff,	// int32	2147483647
511272343Sngie		0xff,
512272343Sngie		0x13, 0xff, 0xff, 0xff,	// int64	-2147483649
513272343Sngie		0xff, 0x7f, 0xff, 0xff,
514272343Sngie		0xff,
515272343Sngie		0x13, 0x00, 0x00, 0x00,	// int64	2147483648
516272343Sngie		0x00, 0x80, 0x00, 0x00,
517272343Sngie		0x00,
518272343Sngie		0x13, 0x80, 0x00, 0x00,	// int64	-9223372036854775808
519272343Sngie		0x00, 0x00, 0x00, 0x00,
520272343Sngie		0x00,
521272343Sngie		0x13, 0x7f, 0xff, 0xff,	// int64	9223372036854775807
522272343Sngie		0xff, 0xff, 0xff, 0xff,
523272343Sngie		0xff,
524272343Sngie	};
525272343Sngie
526272343Sngie	ATF_REQUIRE_EQ(test.end - test.next, sizeof(expect));
527272343Sngie	ATF_CHECK(memcmp(expect, test.next, sizeof(expect)) == 0);
528272343Sngie}
529272343Sngie
530272343SngieATF_TC(check_sdp_put_int8);
531272343Sngie
532272343SngieATF_TC_HEAD(check_sdp_put_int8, tc)
533272343Sngie{
534272343Sngie
535272343Sngie	atf_tc_set_md_var(tc, "descr", "Test sdp_put_int8 results");
536272343Sngie}
537272343Sngie
538272343SngieATF_TC_BODY(check_sdp_put_int8, tc)
539272343Sngie{
540272343Sngie	uint8_t buf[256];
541272343Sngie	sdp_data_t test = { buf, buf + sizeof(buf) };
542272343Sngie
543272343Sngie	ATF_REQUIRE(sdp_put_int8(&test, (int8_t)0));
544272343Sngie	ATF_REQUIRE(sdp_put_int8(&test, (int8_t)INT8_MIN));
545272343Sngie	ATF_REQUIRE(sdp_put_int8(&test, (int8_t)INT8_MAX));
546272343Sngie	test.end = test.next;
547272343Sngie	test.next = buf;
548272343Sngie
549272343Sngie	const uint8_t expect[] = {
550272343Sngie		0x10, 0x00,		// int8		0
551272343Sngie		0x10, 0x80,		// int8		-128
552272343Sngie		0x10, 0x7f,		// int8		127
553272343Sngie	};
554272343Sngie
555272343Sngie	ATF_REQUIRE_EQ(test.end - test.next, sizeof(expect));
556272343Sngie	ATF_CHECK(memcmp(expect, test.next, sizeof(expect)) == 0);
557272343Sngie}
558272343Sngie
559272343SngieATF_TC(check_sdp_put_int16);
560272343Sngie
561272343SngieATF_TC_HEAD(check_sdp_put_int16, tc)
562272343Sngie{
563272343Sngie
564272343Sngie	atf_tc_set_md_var(tc, "descr", "Test sdp_put_int16 results");
565272343Sngie}
566272343Sngie
567272343SngieATF_TC_BODY(check_sdp_put_int16, tc)
568272343Sngie{
569272343Sngie	uint8_t buf[256];
570272343Sngie	sdp_data_t test = { buf, buf + sizeof(buf) };
571272343Sngie
572272343Sngie	ATF_REQUIRE(sdp_put_int16(&test, (int16_t)0));
573272343Sngie	ATF_REQUIRE(sdp_put_int16(&test, (int16_t)INT8_MIN));
574272343Sngie	ATF_REQUIRE(sdp_put_int16(&test, (int16_t)INT8_MAX));
575272343Sngie	ATF_REQUIRE(sdp_put_int16(&test, (int16_t)INT16_MIN));
576272343Sngie	ATF_REQUIRE(sdp_put_int16(&test, (int16_t)INT16_MAX));
577272343Sngie	test.end = test.next;
578272343Sngie	test.next = buf;
579272343Sngie
580272343Sngie	const uint8_t expect[] = {
581272343Sngie		0x11, 0x00, 0x00,	// int16	0
582272343Sngie		0x11, 0xff, 0x80,	// int16	-128
583272343Sngie		0x11, 0x00, 0x7f,	// int16	127
584272343Sngie		0x11, 0x80, 0x00,	// int16	-32768
585272343Sngie		0x11, 0x7f, 0xff,	// int16	32767
586272343Sngie	};
587272343Sngie
588272343Sngie	ATF_REQUIRE_EQ(test.end - test.next, sizeof(expect));
589272343Sngie	ATF_CHECK(memcmp(expect, test.next, sizeof(expect)) == 0);
590272343Sngie}
591272343Sngie
592272343SngieATF_TC(check_sdp_put_int32);
593272343Sngie
594272343SngieATF_TC_HEAD(check_sdp_put_int32, tc)
595272343Sngie{
596272343Sngie
597272343Sngie	atf_tc_set_md_var(tc, "descr", "Test sdp_put_int32 results");
598272343Sngie}
599272343Sngie
600272343SngieATF_TC_BODY(check_sdp_put_int32, tc)
601272343Sngie{
602272343Sngie	uint8_t buf[256];
603272343Sngie	sdp_data_t test = { buf, buf + sizeof(buf) };
604272343Sngie
605272343Sngie	ATF_REQUIRE(sdp_put_int32(&test, (int32_t)0));
606272343Sngie	ATF_REQUIRE(sdp_put_int32(&test, (int32_t)INT8_MIN));
607272343Sngie	ATF_REQUIRE(sdp_put_int32(&test, (int32_t)INT8_MAX));
608272343Sngie	ATF_REQUIRE(sdp_put_int32(&test, (int32_t)INT16_MIN));
609272343Sngie	ATF_REQUIRE(sdp_put_int32(&test, (int32_t)INT16_MAX));
610272343Sngie	ATF_REQUIRE(sdp_put_int32(&test, (int32_t)INT32_MIN));
611272343Sngie	ATF_REQUIRE(sdp_put_int32(&test, (int32_t)INT32_MAX));
612272343Sngie	test.end = test.next;
613272343Sngie	test.next = buf;
614272343Sngie
615272343Sngie	const uint8_t expect[] = {
616272343Sngie		0x12, 0x00, 0x00, 0x00,	// int32	0
617272343Sngie		0x00,
618272343Sngie		0x12, 0xff, 0xff, 0xff,	// int32	-128
619272343Sngie		0x80,
620272343Sngie		0x12, 0x00, 0x00, 0x00,	// int32	127
621272343Sngie		0x7f,
622272343Sngie		0x12, 0xff, 0xff, 0x80,	// int32	-32768
623272343Sngie		0x00,
624272343Sngie		0x12, 0x00, 0x00, 0x7f,	// int32	32767
625272343Sngie		0xff,
626272343Sngie		0x12, 0x80, 0x00, 0x00,	// int32	-2147483648
627272343Sngie		0x00,
628272343Sngie		0x12, 0x7f, 0xff, 0xff,	// int32	2147483647
629272343Sngie		0xff,
630272343Sngie	};
631272343Sngie
632272343Sngie	ATF_REQUIRE_EQ(test.end - test.next, sizeof(expect));
633272343Sngie	ATF_CHECK(memcmp(expect, test.next, sizeof(expect)) == 0);
634272343Sngie}
635272343Sngie
636272343SngieATF_TC(check_sdp_put_int64);
637272343Sngie
638272343SngieATF_TC_HEAD(check_sdp_put_int64, tc)
639272343Sngie{
640272343Sngie
641272343Sngie	atf_tc_set_md_var(tc, "descr", "Test sdp_put_int64 results");
642272343Sngie}
643272343Sngie
644272343SngieATF_TC_BODY(check_sdp_put_int64, tc)
645272343Sngie{
646272343Sngie	uint8_t buf[256];
647272343Sngie	sdp_data_t test = { buf, buf + sizeof(buf) };
648272343Sngie
649272343Sngie	ATF_REQUIRE(sdp_put_int64(&test, (int64_t)0));
650272343Sngie	ATF_REQUIRE(sdp_put_int64(&test, (int64_t)INT8_MIN));
651272343Sngie	ATF_REQUIRE(sdp_put_int64(&test, (int64_t)INT8_MAX));
652272343Sngie	ATF_REQUIRE(sdp_put_int64(&test, (int64_t)INT16_MIN));
653272343Sngie	ATF_REQUIRE(sdp_put_int64(&test, (int64_t)INT16_MAX));
654272343Sngie	ATF_REQUIRE(sdp_put_int64(&test, (int64_t)INT32_MIN));
655272343Sngie	ATF_REQUIRE(sdp_put_int64(&test, (int64_t)INT32_MAX));
656272343Sngie	ATF_REQUIRE(sdp_put_int64(&test, (int64_t)INT64_MIN));
657272343Sngie	ATF_REQUIRE(sdp_put_int64(&test, (int64_t)INT64_MAX));
658272343Sngie	test.end = test.next;
659272343Sngie	test.next = buf;
660272343Sngie
661272343Sngie	const uint8_t expect[] = {
662272343Sngie		0x13, 0x00, 0x00, 0x00,	// int64	0
663272343Sngie		0x00, 0x00, 0x00, 0x00,
664272343Sngie		0x00,
665272343Sngie		0x13, 0xff, 0xff, 0xff,	// int64	-128
666272343Sngie		0xff, 0xff, 0xff, 0xff,
667272343Sngie		0x80,
668272343Sngie		0x13, 0x00, 0x00, 0x00,	// int64	127
669272343Sngie		0x00, 0x00, 0x00, 0x00,
670272343Sngie		0x7f,
671272343Sngie		0x13, 0xff, 0xff, 0xff,	// int64	-32768
672272343Sngie		0xff, 0xff, 0xff, 0x80,
673272343Sngie		0x00,
674272343Sngie		0x13, 0x00, 0x00, 0x00,	// int64	32767
675272343Sngie		0x00, 0x00, 0x00, 0x7f,
676272343Sngie		0xff,
677272343Sngie		0x13, 0xff, 0xff, 0xff,	// int64	-2147483648
678272343Sngie		0xff, 0x80, 0x00, 0x00,
679272343Sngie		0x00,
680272343Sngie		0x13, 0x00, 0x00, 0x00,	// int64	2147483647
681272343Sngie		0x00, 0x7f, 0xff, 0xff,
682272343Sngie		0xff,
683272343Sngie		0x13, 0x80, 0x00, 0x00,	// int64	-9223372036854775808
684272343Sngie		0x00, 0x00, 0x00, 0x00,
685272343Sngie		0x00,
686272343Sngie		0x13, 0x7f, 0xff, 0xff,	// int64	9223372036854775807
687272343Sngie		0xff, 0xff, 0xff, 0xff,
688272343Sngie		0xff,
689272343Sngie	};
690272343Sngie
691272343Sngie	ATF_REQUIRE_EQ(test.end - test.next, sizeof(expect));
692272343Sngie	ATF_CHECK(memcmp(expect, test.next, sizeof(expect)) == 0);
693272343Sngie}
694272343Sngie
695272343SngieATF_TC(check_sdp_put_seq);
696272343Sngie
697272343SngieATF_TC_HEAD(check_sdp_put_seq, tc)
698272343Sngie{
699272343Sngie
700272343Sngie	atf_tc_set_md_var(tc, "descr", "Test sdp_put_seq results");
701272343Sngie}
702272343Sngie
703272343SngieATF_TC_BODY(check_sdp_put_seq, tc)
704272343Sngie{
705272343Sngie	uint8_t buf[512];
706272343Sngie	sdp_data_t test = { buf, buf + sizeof(buf) };
707272343Sngie
708272343Sngie	ATF_REQUIRE(sdp_put_seq(&test, (ssize_t)0));
709272343Sngie	ATF_REQUIRE(sdp_put_seq(&test, (ssize_t)UINT8_MAX));
710272343Sngie	ATF_REQUIRE(sdp_put_seq(&test, (ssize_t)UINT8_MAX + 1));
711272343Sngie	ATF_REQUIRE(sdp_put_seq(&test, (ssize_t)-1));
712272343Sngie	ATF_CHECK_EQ(sdp_put_seq(&test, (ssize_t)UINT16_MAX), false);	/* no room */
713272343Sngie	ATF_CHECK_EQ(sdp_put_seq(&test, (ssize_t)SSIZE_MAX), false);	/* no room */
714272343Sngie	test.end = test.next;
715272343Sngie	test.next = buf;
716272343Sngie
717272343Sngie	/* (not a valid element list) */
718272343Sngie	const uint8_t expect[] = {
719272343Sngie		0x35, 0x00,		// seq8(0)
720272343Sngie		0x35, 0xff,		// seq8(255)
721272343Sngie		0x36, 0x01, 0x00,	// seq16(256)
722272343Sngie		0x36, 0x01, 0xf6,	// seq16(502)	<- sizeof(buf) - 7 - 3
723272343Sngie	};
724272343Sngie
725272343Sngie	ATF_REQUIRE_EQ(test.end - test.next, sizeof(expect));
726272343Sngie	ATF_CHECK(memcmp(expect, test.next, sizeof(expect)) == 0);
727272343Sngie}
728272343Sngie
729272343SngieATF_TC(check_sdp_put_alt);
730272343Sngie
731272343SngieATF_TC_HEAD(check_sdp_put_alt, tc)
732272343Sngie{
733272343Sngie
734272343Sngie	atf_tc_set_md_var(tc, "descr", "Test sdp_put_alt results");
735272343Sngie}
736272343Sngie
737272343SngieATF_TC_BODY(check_sdp_put_alt, tc)
738272343Sngie{
739272343Sngie	uint8_t buf[512];
740272343Sngie	sdp_data_t test = { buf, buf + sizeof(buf) };
741272343Sngie
742272343Sngie	ATF_REQUIRE(sdp_put_alt(&test, (ssize_t)0));
743272343Sngie	ATF_REQUIRE(sdp_put_alt(&test, (ssize_t)UINT8_MAX));
744272343Sngie	ATF_REQUIRE(sdp_put_alt(&test, (ssize_t)UINT8_MAX + 1));
745272343Sngie	ATF_REQUIRE(sdp_put_alt(&test, (ssize_t)-1));
746272343Sngie	ATF_CHECK_EQ(sdp_put_alt(&test, (ssize_t)UINT16_MAX), false);	/* no room */
747272343Sngie	ATF_CHECK_EQ(sdp_put_alt(&test, (ssize_t)SSIZE_MAX), false);	/* no room */
748272343Sngie	test.end = test.next;
749272343Sngie	test.next = buf;
750272343Sngie
751272343Sngie	/* (not a valid element list) */
752272343Sngie	const uint8_t expect[] = {
753272343Sngie		0x3d, 0x00,		// alt8(0)
754272343Sngie		0x3d, 0xff,		// alt8(255)
755272343Sngie		0x3e, 0x01, 0x00,	// alt16(256)
756272343Sngie		0x3e, 0x01, 0xf6,	// alt16(502)	<- sizeof(buf) - 7 - 3
757272343Sngie	};
758272343Sngie
759272343Sngie	ATF_REQUIRE_EQ(test.end - test.next, sizeof(expect));
760272343Sngie	ATF_CHECK(memcmp(expect, test.next, sizeof(expect)) == 0);
761272343Sngie}
762272343Sngie
763272343SngieATF_TC(check_sdp_put_str);
764272343Sngie
765272343SngieATF_TC_HEAD(check_sdp_put_str, tc)
766272343Sngie{
767272343Sngie
768272343Sngie	atf_tc_set_md_var(tc, "descr", "Test sdp_put_str results");
769272343Sngie}
770272343Sngie
771272343SngieATF_TC_BODY(check_sdp_put_str, tc)
772272343Sngie{
773272343Sngie	uint8_t buf[512];
774272343Sngie	sdp_data_t test = { buf, buf + sizeof(buf) };
775272343Sngie
776272343Sngie	/*
777272343Sngie	 * this does not test str16 or str32, but that is
778272343Sngie	 * handled by the same code as sdp_put_seq above..
779272343Sngie	 */
780272343Sngie
781272343Sngie	ATF_REQUIRE(sdp_put_str(&test, "Hello World!", 5));
782272343Sngie	ATF_REQUIRE(sdp_put_str(&test, "Hello\0World", 11));
783272343Sngie	ATF_REQUIRE(sdp_put_str(&test, "Hello World!", -1));
784272343Sngie	ATF_REQUIRE(sdp_put_str(&test, "Hello\0World", -1));
785272343Sngie	test.end = test.next;
786272343Sngie	test.next = buf;
787272343Sngie
788272343Sngie	const uint8_t expect[] = {
789272343Sngie		0x25, 0x05, 0x48, 0x65,	// str8		"Hello"
790272343Sngie		0x6c, 0x6c, 0x6f,
791272343Sngie		0x25, 0x0b, 0x48, 0x65,	// str8		"Hello\0World"
792272343Sngie		0x6c, 0x6c, 0x6f, 0x00,
793272343Sngie		0x57, 0x6f, 0x72, 0x6c,
794272343Sngie		0x64,
795272343Sngie		0x25, 0x0c, 0x48, 0x65,	// str8		"Hello World!"
796272343Sngie		0x6c, 0x6c, 0x6f, 0x20,
797272343Sngie		0x57, 0x6f, 0x72, 0x6c,
798272343Sngie		0x64, 0x21,
799272343Sngie		0x25, 0x05, 0x48, 0x65,	// str8		"Hello"
800272343Sngie		0x6c, 0x6c, 0x6f,
801272343Sngie	};
802272343Sngie
803272343Sngie	ATF_REQUIRE_EQ(test.end - test.next, sizeof(expect));
804272343Sngie	ATF_CHECK(memcmp(expect, test.next, sizeof(expect)) == 0);
805272343Sngie}
806272343Sngie
807272343SngieATF_TC(check_sdp_put_url);
808272343Sngie
809272343SngieATF_TC_HEAD(check_sdp_put_url, tc)
810272343Sngie{
811272343Sngie
812272343Sngie	atf_tc_set_md_var(tc, "descr", "Test sdp_put_url results");
813272343Sngie}
814272343Sngie
815272343SngieATF_TC_BODY(check_sdp_put_url, tc)
816272343Sngie{
817272343Sngie	uint8_t buf[512];
818272343Sngie	sdp_data_t test = { buf, buf + sizeof(buf) };
819272343Sngie
820272343Sngie	/*
821272343Sngie	 * this does not test url16 or url32, but that is
822272343Sngie	 * handled by the same code as sdp_put_seq above..
823272343Sngie	 */
824272343Sngie
825272343Sngie	ATF_REQUIRE(sdp_put_url(&test, "http://www.netbsd.org/", 21));
826272343Sngie	ATF_REQUIRE(sdp_put_url(&test, "http://www.netbsd.org/", -1));
827272343Sngie	test.end = test.next;
828272343Sngie	test.next = buf;
829272343Sngie
830272343Sngie	const uint8_t expect[] = {
831272343Sngie		0x45, 0x15, 0x68, 0x74,	// url8	"http://www.netbsd.org"
832272343Sngie		0x74, 0x70, 0x3a, 0x2f,
833272343Sngie		0x2f, 0x77, 0x77, 0x77,
834272343Sngie		0x2e, 0x6e, 0x65, 0x74,
835272343Sngie		0x62, 0x73, 0x64, 0x2e,
836272343Sngie		0x6f, 0x72, 0x67,
837272343Sngie		0x45, 0x16, 0x68, 0x74,	// url8	"http://www.netbsd.org/"
838272343Sngie		0x74, 0x70, 0x3a, 0x2f,
839272343Sngie		0x2f, 0x77, 0x77, 0x77,
840272343Sngie		0x2e, 0x6e, 0x65, 0x74,
841272343Sngie		0x62, 0x73, 0x64, 0x2e,
842272343Sngie		0x6f, 0x72, 0x67, 0x2f,
843272343Sngie	};
844272343Sngie
845272343Sngie	ATF_REQUIRE_EQ(test.end - test.next, sizeof(expect));
846272343Sngie	ATF_CHECK(memcmp(expect, test.next, sizeof(expect)) == 0);
847272343Sngie}
848272343Sngie
849272343SngieATF_TP_ADD_TCS(tp)
850272343Sngie{
851272343Sngie
852272343Sngie	ATF_TP_ADD_TC(tp, check_sdp_put_data);
853272343Sngie	ATF_TP_ADD_TC(tp, check_sdp_put_attr);
854272343Sngie	ATF_TP_ADD_TC(tp, check_sdp_put_uuid);
855272343Sngie	ATF_TP_ADD_TC(tp, check_sdp_put_uuid16);
856272343Sngie	ATF_TP_ADD_TC(tp, check_sdp_put_uuid32);
857272343Sngie	ATF_TP_ADD_TC(tp, check_sdp_put_uuid128);
858272343Sngie	ATF_TP_ADD_TC(tp, check_sdp_put_bool);
859272343Sngie	ATF_TP_ADD_TC(tp, check_sdp_put_uint);
860272343Sngie	ATF_TP_ADD_TC(tp, check_sdp_put_uint8);
861272343Sngie	ATF_TP_ADD_TC(tp, check_sdp_put_uint16);
862272343Sngie	ATF_TP_ADD_TC(tp, check_sdp_put_uint32);
863272343Sngie	ATF_TP_ADD_TC(tp, check_sdp_put_uint64);
864272343Sngie	ATF_TP_ADD_TC(tp, check_sdp_put_int);
865272343Sngie	ATF_TP_ADD_TC(tp, check_sdp_put_int8);
866272343Sngie	ATF_TP_ADD_TC(tp, check_sdp_put_int16);
867272343Sngie	ATF_TP_ADD_TC(tp, check_sdp_put_int32);
868272343Sngie	ATF_TP_ADD_TC(tp, check_sdp_put_int64);
869272343Sngie	ATF_TP_ADD_TC(tp, check_sdp_put_seq);
870272343Sngie	ATF_TP_ADD_TC(tp, check_sdp_put_alt);
871272343Sngie	ATF_TP_ADD_TC(tp, check_sdp_put_str);
872272343Sngie	ATF_TP_ADD_TC(tp, check_sdp_put_url);
873272343Sngie
874272343Sngie	return atf_no_error();
875272343Sngie}
876