1b236bcf1SEnji Cooper /*-
2b236bcf1SEnji Cooper  * Copyright (c) 2013 The FreeBSD Foundation
3b236bcf1SEnji Cooper  * All rights reserved.
4b236bcf1SEnji Cooper  *
5b236bcf1SEnji Cooper  * This software was developed by Pawel Jakub Dawidek under sponsorship from
6b236bcf1SEnji Cooper  * the FreeBSD Foundation.
7b236bcf1SEnji Cooper  *
8b236bcf1SEnji Cooper  * Redistribution and use in source and binary forms, with or without
9b236bcf1SEnji Cooper  * modification, are permitted provided that the following conditions
10b236bcf1SEnji Cooper  * are met:
11b236bcf1SEnji Cooper  * 1. Redistributions of source code must retain the above copyright
12b236bcf1SEnji Cooper  *    notice, this list of conditions and the following disclaimer.
13b236bcf1SEnji Cooper  * 2. Redistributions in binary form must reproduce the above copyright
14b236bcf1SEnji Cooper  *    notice, this list of conditions and the following disclaimer in the
15b236bcf1SEnji Cooper  *    documentation and/or other materials provided with the distribution.
16b236bcf1SEnji Cooper  *
17b236bcf1SEnji Cooper  * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
18b236bcf1SEnji Cooper  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19b236bcf1SEnji Cooper  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20b236bcf1SEnji Cooper  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
21b236bcf1SEnji Cooper  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22b236bcf1SEnji Cooper  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23b236bcf1SEnji Cooper  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24b236bcf1SEnji Cooper  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25b236bcf1SEnji Cooper  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26b236bcf1SEnji Cooper  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27b236bcf1SEnji Cooper  * SUCH DAMAGE.
28b236bcf1SEnji Cooper  */
29b236bcf1SEnji Cooper 
30c36e54bbSMariusz Zaborski #include <sys/nv.h>
31c36e54bbSMariusz Zaborski 
32b236bcf1SEnji Cooper #include <stdio.h>
33b236bcf1SEnji Cooper #include <unistd.h>
34b236bcf1SEnji Cooper 
35b236bcf1SEnji Cooper static int ntest = 1;
36b236bcf1SEnji Cooper 
37b236bcf1SEnji Cooper #define	CHECK(expr)	do {						\
38b236bcf1SEnji Cooper 	if ((expr))							\
39b236bcf1SEnji Cooper 		printf("ok # %d %s:%u\n", ntest, __FILE__, __LINE__);	\
40b236bcf1SEnji Cooper 	else								\
41b236bcf1SEnji Cooper 		printf("not ok # %d %s:%u\n", ntest, __FILE__, __LINE__);\
42b236bcf1SEnji Cooper 	ntest++;							\
43b236bcf1SEnji Cooper } while (0)
44b236bcf1SEnji Cooper 
45b236bcf1SEnji Cooper int
main(void)46b236bcf1SEnji Cooper main(void)
47b236bcf1SEnji Cooper {
48b236bcf1SEnji Cooper 	nvlist_t *nvl;
49b236bcf1SEnji Cooper 
50b236bcf1SEnji Cooper 	printf("1..232\n");
51b236bcf1SEnji Cooper 
52b236bcf1SEnji Cooper 	nvl = nvlist_create(0);
53b236bcf1SEnji Cooper 
54b236bcf1SEnji Cooper 	CHECK(!nvlist_exists(nvl, "nvlist/null"));
55b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_null(nvl, "nvlist/null"));
56b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_bool(nvl, "nvlist/null"));
57b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_number(nvl, "nvlist/null"));
58b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_string(nvl, "nvlist/null"));
59b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_nvlist(nvl, "nvlist/null"));
60b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_descriptor(nvl, "nvlist/null"));
61b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_binary(nvl, "nvlist/null"));
62b236bcf1SEnji Cooper 	nvlist_add_null(nvl, "nvlist/null");
63b236bcf1SEnji Cooper 	CHECK(nvlist_error(nvl) == 0);
64b236bcf1SEnji Cooper 	CHECK(nvlist_exists(nvl, "nvlist/null"));
65b236bcf1SEnji Cooper 	CHECK(nvlist_exists_null(nvl, "nvlist/null"));
66b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_bool(nvl, "nvlist/null"));
67b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_number(nvl, "nvlist/null"));
68b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_string(nvl, "nvlist/null"));
69b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_nvlist(nvl, "nvlist/null"));
70b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_descriptor(nvl, "nvlist/null"));
71b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_binary(nvl, "nvlist/null"));
72b236bcf1SEnji Cooper 
73b236bcf1SEnji Cooper 	CHECK(!nvlist_exists(nvl, "nvlist/bool"));
74b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_null(nvl, "nvlist/bool"));
75b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_bool(nvl, "nvlist/bool"));
76b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_number(nvl, "nvlist/bool"));
77b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_string(nvl, "nvlist/bool"));
78b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_nvlist(nvl, "nvlist/bool"));
79b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_descriptor(nvl, "nvlist/bool"));
80b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_binary(nvl, "nvlist/bool"));
81b236bcf1SEnji Cooper 	nvlist_add_bool(nvl, "nvlist/bool", true);
82b236bcf1SEnji Cooper 	CHECK(nvlist_error(nvl) == 0);
83b236bcf1SEnji Cooper 	CHECK(nvlist_exists(nvl, "nvlist/bool"));
84b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_null(nvl, "nvlist/bool"));
85b236bcf1SEnji Cooper 	CHECK(nvlist_exists_bool(nvl, "nvlist/bool"));
86b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_number(nvl, "nvlist/bool"));
87b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_string(nvl, "nvlist/bool"));
88b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_nvlist(nvl, "nvlist/bool"));
89b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_descriptor(nvl, "nvlist/bool"));
90b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_binary(nvl, "nvlist/bool"));
91b236bcf1SEnji Cooper 
92b236bcf1SEnji Cooper 	CHECK(!nvlist_exists(nvl, "nvlist/number"));
93b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_null(nvl, "nvlist/number"));
94b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_bool(nvl, "nvlist/number"));
95b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_number(nvl, "nvlist/number"));
96b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_string(nvl, "nvlist/number"));
97b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_nvlist(nvl, "nvlist/number"));
98b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_descriptor(nvl, "nvlist/number"));
99b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_binary(nvl, "nvlist/number"));
100b236bcf1SEnji Cooper 	nvlist_add_number(nvl, "nvlist/number", 0);
101b236bcf1SEnji Cooper 	CHECK(nvlist_error(nvl) == 0);
102b236bcf1SEnji Cooper 	CHECK(nvlist_exists(nvl, "nvlist/number"));
103b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_null(nvl, "nvlist/number"));
104b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_bool(nvl, "nvlist/number"));
105b236bcf1SEnji Cooper 	CHECK(nvlist_exists_number(nvl, "nvlist/number"));
106b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_string(nvl, "nvlist/number"));
107b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_nvlist(nvl, "nvlist/number"));
108b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_descriptor(nvl, "nvlist/number"));
109b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_binary(nvl, "nvlist/number"));
110b236bcf1SEnji Cooper 
111b236bcf1SEnji Cooper 	CHECK(!nvlist_exists(nvl, "nvlist/string"));
112b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_null(nvl, "nvlist/string"));
113b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_bool(nvl, "nvlist/string"));
114b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_number(nvl, "nvlist/string"));
115b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_string(nvl, "nvlist/string"));
116b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_nvlist(nvl, "nvlist/string"));
117b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_descriptor(nvl, "nvlist/string"));
118b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_binary(nvl, "nvlist/string"));
119b236bcf1SEnji Cooper 	nvlist_add_string(nvl, "nvlist/string", "test");
120b236bcf1SEnji Cooper 	CHECK(nvlist_error(nvl) == 0);
121b236bcf1SEnji Cooper 	CHECK(nvlist_exists(nvl, "nvlist/string"));
122b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_null(nvl, "nvlist/string"));
123b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_bool(nvl, "nvlist/string"));
124b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_number(nvl, "nvlist/string"));
125b236bcf1SEnji Cooper 	CHECK(nvlist_exists_string(nvl, "nvlist/string"));
126b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_nvlist(nvl, "nvlist/string"));
127b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_descriptor(nvl, "nvlist/string"));
128b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_binary(nvl, "nvlist/string"));
129b236bcf1SEnji Cooper 
130b236bcf1SEnji Cooper 	CHECK(!nvlist_exists(nvl, "nvlist/nvlist"));
131b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_null(nvl, "nvlist/nvlist"));
132b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_bool(nvl, "nvlist/nvlist"));
133b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_number(nvl, "nvlist/nvlist"));
134b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_string(nvl, "nvlist/nvlist"));
135b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_nvlist(nvl, "nvlist/nvlist"));
136b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_descriptor(nvl, "nvlist/nvlist"));
137b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_binary(nvl, "nvlist/nvlist"));
138b236bcf1SEnji Cooper 	nvlist_add_nvlist(nvl, "nvlist/nvlist", nvl);
139b236bcf1SEnji Cooper 	CHECK(nvlist_error(nvl) == 0);
140b236bcf1SEnji Cooper 	CHECK(nvlist_exists(nvl, "nvlist/nvlist"));
141b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_null(nvl, "nvlist/nvlist"));
142b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_bool(nvl, "nvlist/nvlist"));
143b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_number(nvl, "nvlist/nvlist"));
144b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_string(nvl, "nvlist/nvlist"));
145b236bcf1SEnji Cooper 	CHECK(nvlist_exists_nvlist(nvl, "nvlist/nvlist"));
146b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_descriptor(nvl, "nvlist/nvlist"));
147b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_binary(nvl, "nvlist/nvlist"));
148b236bcf1SEnji Cooper 
149b236bcf1SEnji Cooper 	CHECK(!nvlist_exists(nvl, "nvlist/descriptor"));
150b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_null(nvl, "nvlist/descriptor"));
151b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_bool(nvl, "nvlist/descriptor"));
152b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_number(nvl, "nvlist/descriptor"));
153b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_string(nvl, "nvlist/descriptor"));
154b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_nvlist(nvl, "nvlist/descriptor"));
155b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_descriptor(nvl, "nvlist/descriptor"));
156b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_binary(nvl, "nvlist/descriptor"));
157b236bcf1SEnji Cooper 	nvlist_add_descriptor(nvl, "nvlist/descriptor", STDERR_FILENO);
158b236bcf1SEnji Cooper 	CHECK(nvlist_error(nvl) == 0);
159b236bcf1SEnji Cooper 	CHECK(nvlist_exists(nvl, "nvlist/descriptor"));
160b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_null(nvl, "nvlist/descriptor"));
161b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_bool(nvl, "nvlist/descriptor"));
162b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_number(nvl, "nvlist/descriptor"));
163b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_string(nvl, "nvlist/descriptor"));
164b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_nvlist(nvl, "nvlist/descriptor"));
165b236bcf1SEnji Cooper 	CHECK(nvlist_exists_descriptor(nvl, "nvlist/descriptor"));
166b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_binary(nvl, "nvlist/descriptor"));
167b236bcf1SEnji Cooper 
168b236bcf1SEnji Cooper 	CHECK(!nvlist_exists(nvl, "nvlist/binary"));
169b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_null(nvl, "nvlist/binary"));
170b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_bool(nvl, "nvlist/binary"));
171b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_number(nvl, "nvlist/binary"));
172b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_string(nvl, "nvlist/binary"));
173b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_nvlist(nvl, "nvlist/binary"));
174b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_descriptor(nvl, "nvlist/binary"));
175b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_binary(nvl, "nvlist/binary"));
176b236bcf1SEnji Cooper 	nvlist_add_binary(nvl, "nvlist/binary", "test", 4);
177b236bcf1SEnji Cooper 	CHECK(nvlist_error(nvl) == 0);
178b236bcf1SEnji Cooper 	CHECK(nvlist_exists(nvl, "nvlist/binary"));
179b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_null(nvl, "nvlist/binary"));
180b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_bool(nvl, "nvlist/binary"));
181b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_number(nvl, "nvlist/binary"));
182b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_string(nvl, "nvlist/binary"));
183b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_nvlist(nvl, "nvlist/binary"));
184b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_descriptor(nvl, "nvlist/binary"));
185b236bcf1SEnji Cooper 	CHECK(nvlist_exists_binary(nvl, "nvlist/binary"));
186b236bcf1SEnji Cooper 
187b236bcf1SEnji Cooper 	CHECK(nvlist_exists(nvl, "nvlist/null"));
188b236bcf1SEnji Cooper 	CHECK(nvlist_exists(nvl, "nvlist/bool"));
189b236bcf1SEnji Cooper 	CHECK(nvlist_exists(nvl, "nvlist/number"));
190b236bcf1SEnji Cooper 	CHECK(nvlist_exists(nvl, "nvlist/string"));
191b236bcf1SEnji Cooper 	CHECK(nvlist_exists(nvl, "nvlist/nvlist"));
192b236bcf1SEnji Cooper 	CHECK(nvlist_exists(nvl, "nvlist/descriptor"));
193b236bcf1SEnji Cooper 	CHECK(nvlist_exists(nvl, "nvlist/binary"));
194b236bcf1SEnji Cooper 	CHECK(nvlist_exists_null(nvl, "nvlist/null"));
195b236bcf1SEnji Cooper 	CHECK(nvlist_exists_bool(nvl, "nvlist/bool"));
196b236bcf1SEnji Cooper 	CHECK(nvlist_exists_number(nvl, "nvlist/number"));
197b236bcf1SEnji Cooper 	CHECK(nvlist_exists_string(nvl, "nvlist/string"));
198b236bcf1SEnji Cooper 	CHECK(nvlist_exists_nvlist(nvl, "nvlist/nvlist"));
199b236bcf1SEnji Cooper 	CHECK(nvlist_exists_descriptor(nvl, "nvlist/descriptor"));
200b236bcf1SEnji Cooper 	CHECK(nvlist_exists_binary(nvl, "nvlist/binary"));
201b236bcf1SEnji Cooper 
202b236bcf1SEnji Cooper 	nvlist_free_null(nvl, "nvlist/null");
203b236bcf1SEnji Cooper 	CHECK(!nvlist_exists(nvl, "nvlist/null"));
204b236bcf1SEnji Cooper 	CHECK(nvlist_exists(nvl, "nvlist/bool"));
205b236bcf1SEnji Cooper 	CHECK(nvlist_exists(nvl, "nvlist/number"));
206b236bcf1SEnji Cooper 	CHECK(nvlist_exists(nvl, "nvlist/string"));
207b236bcf1SEnji Cooper 	CHECK(nvlist_exists(nvl, "nvlist/nvlist"));
208b236bcf1SEnji Cooper 	CHECK(nvlist_exists(nvl, "nvlist/descriptor"));
209b236bcf1SEnji Cooper 	CHECK(nvlist_exists(nvl, "nvlist/binary"));
210b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_null(nvl, "nvlist/null"));
211b236bcf1SEnji Cooper 	CHECK(nvlist_exists_bool(nvl, "nvlist/bool"));
212b236bcf1SEnji Cooper 	CHECK(nvlist_exists_number(nvl, "nvlist/number"));
213b236bcf1SEnji Cooper 	CHECK(nvlist_exists_string(nvl, "nvlist/string"));
214b236bcf1SEnji Cooper 	CHECK(nvlist_exists_nvlist(nvl, "nvlist/nvlist"));
215b236bcf1SEnji Cooper 	CHECK(nvlist_exists_descriptor(nvl, "nvlist/descriptor"));
216b236bcf1SEnji Cooper 	CHECK(nvlist_exists_binary(nvl, "nvlist/binary"));
217b236bcf1SEnji Cooper 
218b236bcf1SEnji Cooper 	nvlist_free_bool(nvl, "nvlist/bool");
219b236bcf1SEnji Cooper 	CHECK(!nvlist_exists(nvl, "nvlist/null"));
220b236bcf1SEnji Cooper 	CHECK(!nvlist_exists(nvl, "nvlist/bool"));
221b236bcf1SEnji Cooper 	CHECK(nvlist_exists(nvl, "nvlist/number"));
222b236bcf1SEnji Cooper 	CHECK(nvlist_exists(nvl, "nvlist/string"));
223b236bcf1SEnji Cooper 	CHECK(nvlist_exists(nvl, "nvlist/nvlist"));
224b236bcf1SEnji Cooper 	CHECK(nvlist_exists(nvl, "nvlist/descriptor"));
225b236bcf1SEnji Cooper 	CHECK(nvlist_exists(nvl, "nvlist/binary"));
226b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_null(nvl, "nvlist/null"));
227b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_bool(nvl, "nvlist/bool"));
228b236bcf1SEnji Cooper 	CHECK(nvlist_exists_number(nvl, "nvlist/number"));
229b236bcf1SEnji Cooper 	CHECK(nvlist_exists_string(nvl, "nvlist/string"));
230b236bcf1SEnji Cooper 	CHECK(nvlist_exists_nvlist(nvl, "nvlist/nvlist"));
231b236bcf1SEnji Cooper 	CHECK(nvlist_exists_descriptor(nvl, "nvlist/descriptor"));
232b236bcf1SEnji Cooper 	CHECK(nvlist_exists_binary(nvl, "nvlist/binary"));
233b236bcf1SEnji Cooper 
234b236bcf1SEnji Cooper 	nvlist_free_number(nvl, "nvlist/number");
235b236bcf1SEnji Cooper 	CHECK(!nvlist_exists(nvl, "nvlist/null"));
236b236bcf1SEnji Cooper 	CHECK(!nvlist_exists(nvl, "nvlist/bool"));
237b236bcf1SEnji Cooper 	CHECK(!nvlist_exists(nvl, "nvlist/number"));
238b236bcf1SEnji Cooper 	CHECK(nvlist_exists(nvl, "nvlist/string"));
239b236bcf1SEnji Cooper 	CHECK(nvlist_exists(nvl, "nvlist/nvlist"));
240b236bcf1SEnji Cooper 	CHECK(nvlist_exists(nvl, "nvlist/descriptor"));
241b236bcf1SEnji Cooper 	CHECK(nvlist_exists(nvl, "nvlist/binary"));
242b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_null(nvl, "nvlist/null"));
243b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_bool(nvl, "nvlist/bool"));
244b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_number(nvl, "nvlist/number"));
245b236bcf1SEnji Cooper 	CHECK(nvlist_exists_string(nvl, "nvlist/string"));
246b236bcf1SEnji Cooper 	CHECK(nvlist_exists_nvlist(nvl, "nvlist/nvlist"));
247b236bcf1SEnji Cooper 	CHECK(nvlist_exists_descriptor(nvl, "nvlist/descriptor"));
248b236bcf1SEnji Cooper 	CHECK(nvlist_exists_binary(nvl, "nvlist/binary"));
249b236bcf1SEnji Cooper 
250b236bcf1SEnji Cooper 	nvlist_free_string(nvl, "nvlist/string");
251b236bcf1SEnji Cooper 	CHECK(!nvlist_exists(nvl, "nvlist/null"));
252b236bcf1SEnji Cooper 	CHECK(!nvlist_exists(nvl, "nvlist/bool"));
253b236bcf1SEnji Cooper 	CHECK(!nvlist_exists(nvl, "nvlist/number"));
254b236bcf1SEnji Cooper 	CHECK(!nvlist_exists(nvl, "nvlist/string"));
255b236bcf1SEnji Cooper 	CHECK(nvlist_exists(nvl, "nvlist/nvlist"));
256b236bcf1SEnji Cooper 	CHECK(nvlist_exists(nvl, "nvlist/descriptor"));
257b236bcf1SEnji Cooper 	CHECK(nvlist_exists(nvl, "nvlist/binary"));
258b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_null(nvl, "nvlist/null"));
259b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_bool(nvl, "nvlist/bool"));
260b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_number(nvl, "nvlist/number"));
261b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_string(nvl, "nvlist/string"));
262b236bcf1SEnji Cooper 	CHECK(nvlist_exists_nvlist(nvl, "nvlist/nvlist"));
263b236bcf1SEnji Cooper 	CHECK(nvlist_exists_descriptor(nvl, "nvlist/descriptor"));
264b236bcf1SEnji Cooper 	CHECK(nvlist_exists_binary(nvl, "nvlist/binary"));
265b236bcf1SEnji Cooper 
266b236bcf1SEnji Cooper 	nvlist_free_nvlist(nvl, "nvlist/nvlist");
267b236bcf1SEnji Cooper 	CHECK(!nvlist_exists(nvl, "nvlist/null"));
268b236bcf1SEnji Cooper 	CHECK(!nvlist_exists(nvl, "nvlist/bool"));
269b236bcf1SEnji Cooper 	CHECK(!nvlist_exists(nvl, "nvlist/number"));
270b236bcf1SEnji Cooper 	CHECK(!nvlist_exists(nvl, "nvlist/string"));
271b236bcf1SEnji Cooper 	CHECK(!nvlist_exists(nvl, "nvlist/nvlist"));
272b236bcf1SEnji Cooper 	CHECK(nvlist_exists(nvl, "nvlist/descriptor"));
273b236bcf1SEnji Cooper 	CHECK(nvlist_exists(nvl, "nvlist/binary"));
274b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_null(nvl, "nvlist/null"));
275b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_bool(nvl, "nvlist/bool"));
276b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_number(nvl, "nvlist/number"));
277b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_string(nvl, "nvlist/string"));
278b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_nvlist(nvl, "nvlist/nvlist"));
279b236bcf1SEnji Cooper 	CHECK(nvlist_exists_descriptor(nvl, "nvlist/descriptor"));
280b236bcf1SEnji Cooper 	CHECK(nvlist_exists_binary(nvl, "nvlist/binary"));
281b236bcf1SEnji Cooper 
282b236bcf1SEnji Cooper 	nvlist_free_descriptor(nvl, "nvlist/descriptor");
283b236bcf1SEnji Cooper 	CHECK(!nvlist_exists(nvl, "nvlist/null"));
284b236bcf1SEnji Cooper 	CHECK(!nvlist_exists(nvl, "nvlist/bool"));
285b236bcf1SEnji Cooper 	CHECK(!nvlist_exists(nvl, "nvlist/number"));
286b236bcf1SEnji Cooper 	CHECK(!nvlist_exists(nvl, "nvlist/string"));
287b236bcf1SEnji Cooper 	CHECK(!nvlist_exists(nvl, "nvlist/nvlist"));
288b236bcf1SEnji Cooper 	CHECK(!nvlist_exists(nvl, "nvlist/descriptor"));
289b236bcf1SEnji Cooper 	CHECK(nvlist_exists(nvl, "nvlist/binary"));
290b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_null(nvl, "nvlist/null"));
291b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_bool(nvl, "nvlist/bool"));
292b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_number(nvl, "nvlist/number"));
293b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_string(nvl, "nvlist/string"));
294b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_nvlist(nvl, "nvlist/nvlist"));
295b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_descriptor(nvl, "nvlist/descriptor"));
296b236bcf1SEnji Cooper 	CHECK(nvlist_exists_binary(nvl, "nvlist/binary"));
297b236bcf1SEnji Cooper 
298b236bcf1SEnji Cooper 	nvlist_free_binary(nvl, "nvlist/binary");
299b236bcf1SEnji Cooper 	CHECK(!nvlist_exists(nvl, "nvlist/null"));
300b236bcf1SEnji Cooper 	CHECK(!nvlist_exists(nvl, "nvlist/bool"));
301b236bcf1SEnji Cooper 	CHECK(!nvlist_exists(nvl, "nvlist/number"));
302b236bcf1SEnji Cooper 	CHECK(!nvlist_exists(nvl, "nvlist/string"));
303b236bcf1SEnji Cooper 	CHECK(!nvlist_exists(nvl, "nvlist/nvlist"));
304b236bcf1SEnji Cooper 	CHECK(!nvlist_exists(nvl, "nvlist/descriptor"));
305b236bcf1SEnji Cooper 	CHECK(!nvlist_exists(nvl, "nvlist/binary"));
306b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_null(nvl, "nvlist/null"));
307b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_bool(nvl, "nvlist/bool"));
308b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_number(nvl, "nvlist/number"));
309b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_string(nvl, "nvlist/string"));
310b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_nvlist(nvl, "nvlist/nvlist"));
311b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_descriptor(nvl, "nvlist/descriptor"));
312b236bcf1SEnji Cooper 	CHECK(!nvlist_exists_binary(nvl, "nvlist/binary"));
313b236bcf1SEnji Cooper 
314b236bcf1SEnji Cooper 	CHECK(nvlist_empty(nvl));
315b236bcf1SEnji Cooper 
316b236bcf1SEnji Cooper 	nvlist_destroy(nvl);
317b236bcf1SEnji Cooper 
318b236bcf1SEnji Cooper 	return (0);
319b236bcf1SEnji Cooper }
320