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