Lines Matching defs:nvl

50 	nvlist_t *nvl;
55 key = "nvl/bool";
56 nvl = nvlist_create(0);
57 ATF_REQUIRE(nvl != NULL);
58 ATF_REQUIRE(nvlist_empty(nvl));
59 ATF_REQUIRE(!nvlist_exists_string_array(nvl, key));
64 nvlist_add_bool_array(nvl, key, testbool, 16);
65 ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
66 ATF_REQUIRE(!nvlist_empty(nvl));
67 ATF_REQUIRE(nvlist_exists_bool_array(nvl, key));
68 ATF_REQUIRE(nvlist_exists_bool_array(nvl, "nvl/bool"));
70 const_result = nvlist_get_bool_array(nvl, key, &num_items);
76 result = nvlist_take_bool_array(nvl, key, &num_items);
82 ATF_REQUIRE(!nvlist_exists_bool_array(nvl, key));
83 ATF_REQUIRE(nvlist_empty(nvl));
84 ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
87 nvlist_destroy(nvl);
95 nvlist_t *nvl;
102 key = "nvl/string";
103 nvl = nvlist_create(0);
104 ATF_REQUIRE(nvl != NULL);
105 ATF_REQUIRE(nvlist_empty(nvl));
106 ATF_REQUIRE(!nvlist_exists_string_array(nvl, key));
108 nvlist_add_string_array(nvl, key, string_arr, nitems(string_arr));
109 ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
110 ATF_REQUIRE(!nvlist_empty(nvl));
111 ATF_REQUIRE(nvlist_exists_string_array(nvl, key));
112 ATF_REQUIRE(nvlist_exists_string_array(nvl, "nvl/string"));
114 const_result = nvlist_get_string_array(nvl, key, &num_items);
115 ATF_REQUIRE(!nvlist_empty(nvl));
127 result = nvlist_take_string_array(nvl, key, &num_items);
138 ATF_REQUIRE(!nvlist_exists_string_array(nvl, key));
139 ATF_REQUIRE(nvlist_empty(nvl));
140 ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
145 nvlist_destroy(nvl);
153 nvlist_t *nvl;
163 key = "nvl/descriptor";
164 nvl = nvlist_create(0);
165 ATF_REQUIRE(nvl != NULL);
166 ATF_REQUIRE(nvlist_empty(nvl));
167 ATF_REQUIRE(!nvlist_exists_descriptor_array(nvl, key));
169 nvlist_add_descriptor_array(nvl, key, fd, nitems(fd));
170 ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
171 ATF_REQUIRE(!nvlist_empty(nvl));
172 ATF_REQUIRE(nvlist_exists_descriptor_array(nvl, key));
173 ATF_REQUIRE(nvlist_exists_descriptor_array(nvl, "nvl/descriptor"));
175 const_result = nvlist_get_descriptor_array(nvl, key, &num_items);
176 ATF_REQUIRE(!nvlist_empty(nvl));
185 result = nvlist_take_descriptor_array(nvl, key, &num_items);
194 ATF_REQUIRE(!nvlist_exists_string_array(nvl, key));
195 ATF_REQUIRE(nvlist_empty(nvl));
196 ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
203 nvlist_destroy(nvl);
211 nvlist_t *nvl;
218 key = "nvl/number";
219 nvl = nvlist_create(0);
220 ATF_REQUIRE(nvl != NULL);
221 ATF_REQUIRE(nvlist_empty(nvl));
222 ATF_REQUIRE(!nvlist_exists_string_array(nvl, key));
224 nvlist_add_number_array(nvl, key, number, nitems(number));
225 ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
226 ATF_REQUIRE(!nvlist_empty(nvl));
227 ATF_REQUIRE(nvlist_exists_number_array(nvl, key));
228 ATF_REQUIRE(nvlist_exists_number_array(nvl, "nvl/number"));
230 const_result = nvlist_get_number_array(nvl, key, &num_items);
231 ATF_REQUIRE(!nvlist_empty(nvl));
237 result = nvlist_take_number_array(nvl, key, &num_items);
243 ATF_REQUIRE(!nvlist_exists_string_array(nvl, key));
244 ATF_REQUIRE(nvlist_empty(nvl));
245 ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
248 nvlist_destroy(nvl);
257 nvlist_t *nvl;
267 nvlist_add_string(testnvl[i], "nvl/string", somestr[i]);
269 ATF_REQUIRE(nvlist_exists_string(testnvl[i], "nvl/string"));
272 key = "nvl/nvlist";
273 nvl = nvlist_create(0);
274 ATF_REQUIRE(nvl != NULL);
275 ATF_REQUIRE(nvlist_empty(nvl));
276 ATF_REQUIRE(!nvlist_exists_string_array(nvl, key));
278 nvlist_add_nvlist_array(nvl, key, (const nvlist_t * const *)testnvl, 8);
279 ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
280 ATF_REQUIRE(!nvlist_empty(nvl));
281 ATF_REQUIRE(nvlist_exists_nvlist_array(nvl, key));
282 ATF_REQUIRE(nvlist_exists_nvlist_array(nvl, "nvl/nvlist"));
284 const_result = nvlist_get_nvlist_array(nvl, key, &num_items);
285 ATF_REQUIRE(!nvlist_empty(nvl));
298 ATF_REQUIRE(nvlist_get_parent(const_result[i], NULL) == nvl);
301 "nvl/string"));
303 "nvl/string"), somestr[i]) == 0);
306 result = nvlist_take_nvlist_array(nvl, key, &num_items);
317 ATF_REQUIRE(!nvlist_exists_string_array(nvl, key));
318 ATF_REQUIRE(nvlist_empty(nvl));
319 ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
327 nvlist_destroy(nvl);
335 const nvlist_t *nvl;
353 nvlist_add_string(testnvl[i], "nvl/nvl/teststr", somestr[i]);
360 ATF_REQUIRE(!nvlist_exists_bool_array(src, "nvl/bool"));
361 nvlist_add_bool_array(src, "nvl/bool", testbool, nitems(testbool));
363 ATF_REQUIRE(nvlist_exists_bool_array(src, "nvl/bool"));
365 ATF_REQUIRE(!nvlist_exists_string_array(src, "nvl/string"));
366 nvlist_add_string_array(src, "nvl/string", string_arr,
369 ATF_REQUIRE(nvlist_exists_string_array(src, "nvl/string"));
371 ATF_REQUIRE(!nvlist_exists_descriptor_array(src, "nvl/fd"));
372 nvlist_add_descriptor_array(src, "nvl/fd", testfd, nitems(testfd));
374 ATF_REQUIRE(nvlist_exists_descriptor_array(src, "nvl/fd"));
376 ATF_REQUIRE(!nvlist_exists_number_array(src, "nvl/number"));
377 nvlist_add_number_array(src, "nvl/number", number,
380 ATF_REQUIRE(nvlist_exists_number_array(src, "nvl/number"));
382 ATF_REQUIRE(!nvlist_exists_nvlist_array(src, "nvl/array"));
383 nvlist_add_nvlist_array(src, "nvl/array",
386 ATF_REQUIRE(nvlist_exists_nvlist_array(src, "nvl/array"));
391 ATF_REQUIRE(nvlist_exists_bool_array(dst, "nvl/bool"));
392 (void) nvlist_get_bool_array(dst, "nvl/bool", &num_items);
396 nvlist_get_bool_array(dst, "nvl/bool", &num_items)[i] ==
397 nvlist_get_bool_array(src, "nvl/bool", &num_items)[i]);
400 ATF_REQUIRE(nvlist_exists_string_array(dst, "nvl/string"));
401 (void) nvlist_get_string_array(dst, "nvl/string", &num_items);
404 if (nvlist_get_string_array(dst, "nvl/string",
406 ATF_REQUIRE(nvlist_get_string_array(dst, "nvl/string",
408 "nvl/string", &num_items)[i]);
411 "nvl/string", &num_items)[i], nvlist_get_string_array(
412 src, "nvl/string", &num_items)[i]) == 0);
416 ATF_REQUIRE(nvlist_exists_descriptor_array(dst, "nvl/fd"));
417 (void) nvlist_get_descriptor_array(dst, "nvl/fd", &num_items);
421 nvlist_get_descriptor_array(dst, "nvl/fd", &num_items)[i]));
423 ATF_REQUIRE(nvlist_exists_number_array(dst, "nvl/number"));
424 (void) nvlist_get_number_array(dst, "nvl/number", &num_items);
429 nvlist_get_number_array(dst, "nvl/number", &num_items)[i] ==
430 nvlist_get_number_array(src, "nvl/number", &num_items)[i]);
433 ATF_REQUIRE(nvlist_exists_nvlist_array(dst, "nvl/array"));
434 (void) nvlist_get_nvlist_array(dst, "nvl/array", &num_items);
437 nvl = nvlist_get_nvlist_array(dst, "nvl/array", &num_items)[i];
438 ATF_REQUIRE(nvlist_exists_string(nvl, "nvl/nvl/teststr"));
439 ATF_REQUIRE(strcmp(nvlist_get_string(nvl, "nvl/nvl/teststr"),
458 nvlist_t *nvl;
463 key = "nvl/bool";
464 nvl = nvlist_create(0);
465 ATF_REQUIRE(nvl != NULL);
466 ATF_REQUIRE(nvlist_empty(nvl));
467 ATF_REQUIRE(!nvlist_exists_string_array(nvl, key));
475 nvlist_move_bool_array(nvl, key, testbool, count);
476 ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
477 ATF_REQUIRE(!nvlist_empty(nvl));
478 ATF_REQUIRE(nvlist_exists_bool_array(nvl, key));
480 const_result = nvlist_get_bool_array(nvl, key, &num_items);
487 nvlist_destroy(nvl);
495 nvlist_t *nvl;
500 key = "nvl/string";
501 nvl = nvlist_create(0);
502 ATF_REQUIRE(nvl != NULL);
503 ATF_REQUIRE(nvlist_empty(nvl));
504 ATF_REQUIRE(!nvlist_exists_string_array(nvl, key));
516 nvlist_move_string_array(nvl, key, teststr, count);
517 ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
518 ATF_REQUIRE(!nvlist_empty(nvl));
519 ATF_REQUIRE(nvlist_exists_string_array(nvl, key));
521 const_result = nvlist_get_string_array(nvl, key, &num_items);
530 nvlist_destroy(nvl);
538 nvlist_t *nvl;
543 key = "nvl/nvlist";
544 nvl = nvlist_create(0);
545 ATF_REQUIRE(nvl != NULL);
546 ATF_REQUIRE(nvlist_empty(nvl));
547 ATF_REQUIRE(!nvlist_exists_nvlist_array(nvl, key));
557 nvlist_move_nvlist_array(nvl, key, testnv, count);
558 ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
559 ATF_REQUIRE(!nvlist_empty(nvl));
560 ATF_REQUIRE(nvlist_exists_nvlist_array(nvl, key));
562 const_result = nvlist_get_nvlist_array(nvl, key, &num_items);
576 ATF_REQUIRE(nvlist_get_parent(const_result[i], NULL) == nvl);
580 nvlist_destroy(nvl);
588 nvlist_t *nvl;
593 key = "nvl/number";
594 nvl = nvlist_create(0);
595 ATF_REQUIRE(nvl != NULL);
596 ATF_REQUIRE(nvlist_empty(nvl));
597 ATF_REQUIRE(!nvlist_exists_string_array(nvl, key));
605 nvlist_move_number_array(nvl, key, testnumber, count);
606 ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
607 ATF_REQUIRE(!nvlist_empty(nvl));
608 ATF_REQUIRE(nvlist_exists_number_array(nvl, key));
610 const_result = nvlist_get_number_array(nvl, key, &num_items);
617 nvlist_destroy(nvl);
625 nvlist_t *nvl;
630 key = "nvl/fd";
631 nvl = nvlist_create(0);
632 ATF_REQUIRE(nvl != NULL);
633 ATF_REQUIRE(nvlist_empty(nvl));
634 ATF_REQUIRE(!nvlist_exists_string_array(nvl, key));
644 nvlist_move_descriptor_array(nvl, key, testfd, count);
645 ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
646 ATF_REQUIRE(!nvlist_empty(nvl));
647 ATF_REQUIRE(nvlist_exists_descriptor_array(nvl, key));
649 const_result = nvlist_get_descriptor_array(nvl, key, &num_items);
656 nvlist_destroy(nvl);
662 nvlist_t *nvl;
664 nvl = nvlist_create(0);
665 ATF_REQUIRE(nvl != NULL);
666 nvlist_add_number_array(nvl, "nvl/number", NULL, 0);
667 ATF_REQUIRE(nvlist_error(nvl) != 0);
668 nvlist_destroy(nvl);
670 nvl = nvlist_create(0);
671 ATF_REQUIRE(nvl != NULL);
672 nvlist_move_number_array(nvl, "nvl/number", NULL, 0);
673 ATF_REQUIRE(nvlist_error(nvl) != 0);
674 nvlist_destroy(nvl);
676 nvl = nvlist_create(0);
677 ATF_REQUIRE(nvl != NULL);
678 nvlist_add_descriptor_array(nvl, "nvl/fd", NULL, 0);
679 ATF_REQUIRE(nvlist_error(nvl) != 0);
680 nvlist_destroy(nvl);
682 nvl = nvlist_create(0);
683 ATF_REQUIRE(nvl != NULL);
684 nvlist_move_descriptor_array(nvl, "nvl/fd", NULL, 0);
685 ATF_REQUIRE(nvlist_error(nvl) != 0);
686 nvlist_destroy(nvl);
688 nvl = nvlist_create(0);
689 ATF_REQUIRE(nvl != NULL);
690 nvlist_add_string_array(nvl, "nvl/string", NULL, 0);
691 ATF_REQUIRE(nvlist_error(nvl) != 0);
692 nvlist_destroy(nvl);
694 nvl = nvlist_create(0);
695 ATF_REQUIRE(nvl != NULL);
696 nvlist_move_string_array(nvl, "nvl/string", NULL, 0);
697 ATF_REQUIRE(nvlist_error(nvl) != 0);
698 nvlist_destroy(nvl);
700 nvl = nvlist_create(0);
701 ATF_REQUIRE(nvl != NULL);
702 nvlist_add_nvlist_array(nvl, "nvl/nvlist", NULL, 0);
703 ATF_REQUIRE(nvlist_error(nvl) != 0);
704 nvlist_destroy(nvl);
706 nvl = nvlist_create(0);
707 ATF_REQUIRE(nvl != NULL);
708 nvlist_move_nvlist_array(nvl, "nvl/nvlist", NULL, 0);
709 ATF_REQUIRE(nvlist_error(nvl) != 0);
710 nvlist_destroy(nvl);
712 nvl = nvlist_create(0);
713 ATF_REQUIRE(nvl != NULL);
714 nvlist_add_bool_array(nvl, "nvl/bool", NULL, 0);
715 ATF_REQUIRE(nvlist_error(nvl) != 0);
716 nvlist_destroy(nvl);
718 nvl = nvlist_create(0);
719 ATF_REQUIRE(nvl != NULL);
720 nvlist_move_bool_array(nvl, "nvl/bool", NULL, 0);
721 ATF_REQUIRE(nvlist_error(nvl) != 0);
722 nvlist_destroy(nvl);
728 nvlist_t *nvl, *nvladd[1], **nvlmove;
732 nvl = nvlist_create(0);
733 ATF_REQUIRE(nvl != NULL);
734 nvlist_add_nvlist_array(nvl, "nvl/nvlist", nvladd, 1);
735 ATF_REQUIRE(nvlist_error(nvl) != 0);
736 nvlist_destroy(nvl);
741 nvl = nvlist_create(0);
742 ATF_REQUIRE(nvl != NULL);
743 nvlist_move_nvlist_array(nvl, "nvl/nvlist", nvlmove, 1);
744 ATF_REQUIRE(nvlist_error(nvl) != 0);
745 nvlist_destroy(nvl);
748 nvl = nvlist_create(0);
749 ATF_REQUIRE(nvl != NULL);
750 nvlist_add_descriptor_array(nvl, "nvl/fd", fdadd, 1);
751 ATF_REQUIRE(nvlist_error(nvl) != 0);
752 nvlist_destroy(nvl);
757 nvl = nvlist_create(0);
758 ATF_REQUIRE(nvl != NULL);
759 nvlist_move_descriptor_array(nvl, "nvl/fd", fdmove, 1);
760 ATF_REQUIRE(nvlist_error(nvl) != 0);
761 nvlist_destroy(nvl);
767 nvlist_t *nvl, *test[5], *nasted;
777 nvlist_add_number(test[i], "nvl/number", i);
780 nvl = nvlist_create(0);
781 ATF_REQUIRE(nvl != NULL);
782 nvlist_add_nvlist_array(nvl, "nvl/nvlist_array", test, nitems(test));
783 ATF_REQUIRE(nvlist_error(nvl) == 0);
786 nvlist_add_nvlist_array(nasted, "nvl/nvl/nvlist_array", test,
789 nvlist_move_nvlist(nvl, "nvl/nvl", nasted);
790 ATF_REQUIRE(nvlist_error(nvl) == 0);
791 nvlist_add_string(nvl, "nvl/string", "END");
792 ATF_REQUIRE(nvlist_error(nvl) == 0);
796 travel = nvl;
829 nvlist_destroy(nvl);
835 nvlist_t *nvl, *test[5], *nasted;
844 nvlist_add_number(test[i], "nvl/number", i);
847 nvl = nvlist_create(0);
848 ATF_REQUIRE(nvl != NULL);
849 nvlist_add_nvlist_array(nvl, "nvl/nvlist_array", test, 5);
850 ATF_REQUIRE(nvlist_error(nvl) == 0);
853 nvlist_add_nvlist_array(nasted, "nvl/nvl/nvlist_array", test, 5);
855 nvlist_move_nvlist(nvl, "nvl/nvl", nasted);
856 ATF_REQUIRE(nvlist_error(nvl) == 0);
857 nvlist_add_string(nvl, "nvl/string", "END");
858 ATF_REQUIRE(nvlist_error(nvl) == 0);
862 tmp = travel = nvl;
902 nvlist_destroy(nvl);
908 nvlist_t *nvl, *unpacked;
919 key = "nvl/bool";
920 nvl = nvlist_create(0);
921 ATF_REQUIRE(nvl != NULL);
922 ATF_REQUIRE(nvlist_empty(nvl));
923 ATF_REQUIRE(!nvlist_exists_string_array(nvl, key));
925 nvlist_add_bool_array(nvl, key, testbool, nitems(testbool));
926 ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
927 ATF_REQUIRE(!nvlist_empty(nvl));
928 ATF_REQUIRE(nvlist_exists_bool_array(nvl, key));
930 packed = nvlist_pack(nvl, &packed_size);
944 nvlist_destroy(nvl);
952 nvlist_t *nvl, *unpacked;
961 key = "nvl/number";
962 nvl = nvlist_create(0);
963 ATF_REQUIRE(nvl != NULL);
964 ATF_REQUIRE(nvlist_empty(nvl));
965 ATF_REQUIRE(!nvlist_exists_string_array(nvl, key));
967 nvlist_add_number_array(nvl, key, number, 8);
968 ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
969 ATF_REQUIRE(!nvlist_empty(nvl));
970 ATF_REQUIRE(nvlist_exists_number_array(nvl, key));
972 packed = nvlist_pack(nvl, &packed_size);
986 nvlist_destroy(nvl);
994 nvlist_t *nvl;
1002 key = "nvl/descriptor";
1017 nvl = nvlist_create(0);
1018 ATF_REQUIRE(nvl != NULL);
1019 ATF_REQUIRE(nvlist_empty(nvl));
1020 ATF_REQUIRE(!nvlist_exists_descriptor_array(nvl, key));
1022 nvlist_add_descriptor_array(nvl, key, desc, nitems(desc));
1023 ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
1024 ATF_REQUIRE(!nvlist_empty(nvl));
1025 ATF_REQUIRE(nvlist_exists_descriptor_array(nvl, key));
1027 ATF_REQUIRE(nvlist_send(fd, nvl) >= 0);
1037 nvl = nvlist_recv(fd, 0);
1038 ATF_REQUIRE(nvl != NULL);
1039 ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
1040 ATF_REQUIRE(nvlist_exists_descriptor_array(nvl, key));
1042 const_result = nvlist_get_descriptor_array(nvl, key, &num_items);
1051 nvlist_destroy(nvl);
1058 nvlist_t *nvl, *unpacked;
1067 key = "nvl/string";
1068 nvl = nvlist_create(0);
1069 ATF_REQUIRE(nvl != NULL);
1070 ATF_REQUIRE(nvlist_empty(nvl));
1071 ATF_REQUIRE(!nvlist_exists_string_array(nvl, key));
1073 nvlist_add_string_array(nvl, key, string_arr, nitems(string_arr));
1074 ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
1075 ATF_REQUIRE(!nvlist_empty(nvl));
1076 ATF_REQUIRE(nvlist_exists_string_array(nvl, key));
1078 packed = nvlist_pack(nvl, &packed_size);
1092 nvlist_destroy(nvl);
1102 nvlist_t *nvl;
1113 nvlist_add_string(testnvl[i], "nvl/string", somestr[i]);
1115 ATF_REQUIRE(nvlist_exists_string(testnvl[i], "nvl/string"));
1118 key = "nvl/nvlist";
1119 nvl = nvlist_create(0);
1120 ATF_REQUIRE(nvl != NULL);
1121 ATF_REQUIRE(nvlist_empty(nvl));
1122 ATF_REQUIRE(!nvlist_exists_string_array(nvl, key));
1124 nvlist_add_nvlist_array(nvl, key, (const nvlist_t * const *)testnvl, 8);
1125 ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
1126 ATF_REQUIRE(!nvlist_empty(nvl));
1127 ATF_REQUIRE(nvlist_exists_nvlist_array(nvl, key));
1128 ATF_REQUIRE(nvlist_exists_nvlist_array(nvl, "nvl/nvlist"));
1129 packed = nvlist_pack(nvl, &packed_size);
1152 "nvl/string"));
1154 "nvl/string"), somestr[i]) == 0);
1159 nvlist_destroy(nvl);
1178 nvlist_add_string_array(testnvl, "nvl/string", somestr,