Lines Matching refs:nvl

44 	nvlist_t *nvl;
48 nvl = nvlist_create(0);
50 ATF_REQUIRE(nvl != NULL);
52 ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
53 ATF_REQUIRE(nvlist_empty(nvl));
56 ATF_REQUIRE_EQ(nvlist_next(nvl, &type, &it), static_cast<const char *>(NULL));
58 nvlist_destroy(nvl);
64 nvlist_t *nvl;
70 nvl = nvlist_create(0);
72 ATF_REQUIRE(nvl != NULL);
73 ATF_REQUIRE(!nvlist_exists(nvl, key));
75 nvlist_add_null(nvl, key);
77 ATF_REQUIRE(!nvlist_empty(nvl));
78 ATF_REQUIRE(nvlist_exists(nvl, key));
79 ATF_REQUIRE(nvlist_exists_null(nvl, key));
80 ATF_REQUIRE(nvlist_exists_null(nvl, "key"));
84 ATF_REQUIRE_EQ(strcmp(nvlist_next(nvl, &type, &it), key), 0);
86 ATF_REQUIRE_EQ(nvlist_next(nvl, &type,&it), static_cast<const char *>(NULL));
88 nvlist_destroy(nvl);
94 nvlist_t *nvl;
100 nvl = nvlist_create(0);
102 ATF_REQUIRE(nvl != NULL);
103 ATF_REQUIRE(!nvlist_exists(nvl, key));
105 nvlist_add_bool(nvl, key, true);
107 ATF_REQUIRE(!nvlist_empty(nvl));
108 ATF_REQUIRE(nvlist_exists(nvl, key));
109 ATF_REQUIRE(nvlist_exists(nvl, "name"));
110 ATF_REQUIRE(nvlist_exists_bool(nvl, key));
111 ATF_REQUIRE(nvlist_exists_bool(nvl, "name"));
112 ATF_REQUIRE_EQ(nvlist_get_bool(nvl, key), true);
116 ATF_REQUIRE_EQ(strcmp(nvlist_next(nvl, &type, &it), key), 0);
118 ATF_REQUIRE_EQ(nvlist_next(nvl, &type,&it), static_cast<const char *>(NULL));
120 nvlist_destroy(nvl);
126 nvlist_t *nvl;
134 nvl = nvlist_create(0);
136 ATF_REQUIRE(nvl != NULL);
137 ATF_REQUIRE(!nvlist_exists(nvl, key));
139 nvlist_add_number(nvl, key, value);
141 ATF_REQUIRE(!nvlist_empty(nvl));
142 ATF_REQUIRE(nvlist_exists(nvl, key));
143 ATF_REQUIRE(nvlist_exists(nvl, "foo123"));
144 ATF_REQUIRE(nvlist_exists_number(nvl, key));
145 ATF_REQUIRE_EQ(nvlist_get_number(nvl, key), value);
149 ATF_REQUIRE_EQ(strcmp(nvlist_next(nvl, &type, &it), key), 0);
151 ATF_REQUIRE_EQ(nvlist_next(nvl, &type,&it), static_cast<const char *>(NULL));
153 nvlist_destroy(nvl);
159 nvlist_t *nvl;
167 nvl = nvlist_create(0);
169 ATF_REQUIRE(nvl != NULL);
170 ATF_REQUIRE(!nvlist_exists(nvl, key));
172 nvlist_add_string(nvl, key, value);
174 ATF_REQUIRE(!nvlist_empty(nvl));
175 ATF_REQUIRE(nvlist_exists(nvl, key));
176 ATF_REQUIRE(nvlist_exists(nvl, "test"));
177 ATF_REQUIRE(nvlist_exists_string(nvl, key));
178 ATF_REQUIRE(nvlist_exists_string(nvl, "test"));
179 ATF_REQUIRE_EQ(strcmp(nvlist_get_string(nvl, key), value), 0);
182 ATF_REQUIRE(nvlist_get_string(nvl, key) != value);
186 ATF_REQUIRE_EQ(strcmp(nvlist_next(nvl, &type, &it), key), 0);
188 ATF_REQUIRE_EQ(nvlist_next(nvl, &type,&it), static_cast<const char *>(NULL));
190 nvlist_destroy(nvl);
196 nvlist_t *nvl;
206 nvl = nvlist_create(0);
208 ATF_REQUIRE(nvl != NULL);
209 ATF_REQUIRE(!nvlist_exists(nvl, key));
212 nvlist_add_nvlist(nvl, key, sublist);
214 ATF_REQUIRE(!nvlist_empty(nvl));
215 ATF_REQUIRE(nvlist_exists(nvl, key));
216 ATF_REQUIRE(nvlist_exists(nvl, "test"));
217 ATF_REQUIRE(nvlist_exists_nvlist(nvl, key));
218 ATF_REQUIRE(nvlist_exists_nvlist(nvl, "test"));
220 value = nvlist_get_nvlist(nvl, key);
228 ATF_REQUIRE_EQ(strcmp(nvlist_next(nvl, &type, &it), key), 0);
230 ATF_REQUIRE_EQ(nvlist_next(nvl, &type,&it), static_cast<const char *>(NULL));
233 nvlist_destroy(nvl);
239 nvlist_t *nvl, *parent;
241 nvl = nvlist_create(0);
244 nvlist_set_error(nvl, EBADF);
245 nvlist_add_nvlist(parent, "test", nvl);
248 nvlist_destroy(nvl);
255 nvlist_t *nvl;
267 nvl = nvlist_create(0);
269 ATF_REQUIRE(nvl != NULL);
270 ATF_REQUIRE(!nvlist_exists(nvl, key));
272 nvlist_add_binary(nvl, key, value, value_size);
274 ATF_REQUIRE(!nvlist_empty(nvl));
275 ATF_REQUIRE(nvlist_exists(nvl, key));
276 ATF_REQUIRE(nvlist_exists(nvl, "binary"));
277 ATF_REQUIRE(nvlist_exists_binary(nvl, key));
278 ATF_REQUIRE(nvlist_exists_binary(nvl, "binary"));
280 ret_value = nvlist_get_binary(nvl, key, &ret_size);
289 ATF_REQUIRE_EQ(strcmp(nvlist_next(nvl, &type, &it), key), 0);
291 ATF_REQUIRE_EQ(nvlist_next(nvl, &type,&it), static_cast<const char *>(NULL));
293 nvlist_destroy(nvl);
300 nvlist_t *nvl, *clone;
302 nvl = nvlist_create(0);
303 ATF_REQUIRE(nvl != NULL);
305 clone = nvlist_clone(nvl);
307 ATF_REQUIRE(clone != nvl);
311 nvlist_destroy(nvl);
317 nvlist_t *nvl, *clone;
323 nvl = nvlist_create(0);
324 ATF_REQUIRE(nvl != NULL);
328 nvlist_add_number(nvl, key, value);
330 clone = nvlist_clone(nvl);
332 ATF_REQUIRE(clone != nvl);
343 nvlist_destroy(nvl);
354 nvlist_t *nvl, *sublist;
356 nvl = nvlist_create(0);
357 ATF_REQUIRE(nvl != NULL);
363 nvlist_move_nvlist(nvl, test_subnvlist_key, sublist);
365 return (nvl);
369 verify_test_nvlist(const nvlist_t *nvl)
375 ATF_REQUIRE(nvlist_exists_nvlist(nvl, test_subnvlist_key));
377 value = nvlist_get_nvlist(nvl, test_subnvlist_key);
391 ATF_REQUIRE_EQ(strcmp(nvlist_next(nvl, &type, &it),
394 ATF_REQUIRE_EQ(nvlist_next(nvl, &type, &it), static_cast<const char *>(NULL));
400 nvlist_t *nvl, *clone;
402 nvl = create_test_nvlist();
403 clone = nvlist_clone(nvl);
406 ATF_REQUIRE(clone != nvl);
410 nvlist_destroy(nvl);
416 nvlist_t *nvl, *clone;
418 nvl = nvlist_create(0);
419 ATF_REQUIRE(nvl != NULL);
421 nvlist_set_error(nvl, ENOMEM);
423 clone = nvlist_clone(nvl);
426 nvlist_destroy(nvl);
432 nvlist_t *nvl, *unpacked;
436 nvl = nvlist_create(0);
437 ATF_REQUIRE(nvl != NULL);
439 packed = nvlist_pack(nvl, &packed_size);
444 ATF_REQUIRE(unpacked != nvl);
448 nvlist_destroy(nvl);
455 nvlist_t *nvl, *unpacked;
459 nvl = nvlist_create(NV_FLAG_NO_UNIQUE);
460 ATF_REQUIRE(nvl != NULL);
462 nvlist_add_bool(nvl, "name", true);
463 ATF_REQUIRE(!nvlist_empty(nvl));
464 ATF_REQUIRE(nvlist_exists_bool(nvl, "name"));
466 packed = nvlist_pack(nvl, &packed_size);
477 ATF_REQUIRE(unpacked != nvl);
482 nvlist_destroy(nvl);
487 verify_null(const nvlist_t *nvl, int type)
494 verify_number(const nvlist_t *nvl, const char *name, int type, uint64_t value)
498 ATF_REQUIRE_EQ(nvlist_get_number(nvl, name), value);
502 verify_string(const nvlist_t *nvl, const char *name, int type,
507 ATF_REQUIRE_EQ(strcmp(nvlist_get_string(nvl, name), value), 0);
511 verify_nvlist(const nvlist_t *nvl, const char *name, int type)
515 verify_test_nvlist(nvlist_get_nvlist(nvl, name));
519 verify_binary(const nvlist_t *nvl, const char *name, int type,
526 actual_value = nvlist_get_binary(nvl, name, &actual_size);
536 nvlist_t *nvl, *unpacked, *nvvalue;
544 nvl = nvlist_create(0);
547 nvlist_add_null(nvl, nullkey);
551 nvlist_add_number(nvl, numkey, numvalue);
555 nvlist_add_string(nvl, strkey, strvalue);
559 nvlist_move_nvlist(nvl, nvkey, nvvalue);
565 nvlist_move_binary(nvl, binkey, binvalue, binsize);
567 packed = nvlist_pack(nvl, &packed_size);
599 nvlist_destroy(nvl);
607 nvlist_t *nvl;
611 nvl = nvlist_create(0);
612 ATF_REQUIRE(nvl != NULL);
614 nvlist_set_error(nvl, ENOMEM);
616 packed = nvlist_pack(nvl, &size);
619 nvlist_destroy(nvl);
625 nvlist_t *nvl, *unpacked;
630 nvl = nvlist_create(0);
634 nvlist_add_number(nvl, key1, 5);
638 nvlist_add_number(nvl, key2, 10);
640 packed = nvlist_pack(nvl, &size);
655 nvlist_destroy(nvl);
662 nvlist_t *nvl;
666 nvl = nvlist_create(0);
667 ATF_REQUIRE(nvl != NULL);
673 nvlist_move_string(nvl, key, value);
674 ATF_REQUIRE_EQ(nvlist_get_string(nvl, key), value);
676 nvlist_destroy(nvl);
696 nvlist_t *nvl, *parent;
698 nvl = nvlist_create(0);
701 nvlist_set_error(nvl, EBADF);
702 nvlist_move_nvlist(parent, "test", nvl);
711 nvlist_t *nvl;
715 nvl = nvlist_create(0);
716 ATF_REQUIRE(nvl != NULL);
722 nvlist_move_nvlist(nvl, key, value);
723 ATF_REQUIRE_EQ(nvlist_get_nvlist(nvl, key), value);
725 nvlist_destroy(nvl);
731 nvlist_t *nvl;
736 nvl = nvlist_create(0);
737 ATF_REQUIRE(nvl != NULL);
744 nvlist_move_binary(nvl, key, value, size);
745 ATF_REQUIRE_EQ(nvlist_get_binary(nvl, key, &actual_size), value);
748 nvlist_destroy(nvl);
754 nvlist_t *nvl;
758 nvl = nvlist_create(0);
759 ATF_REQUIRE(nvl != NULL);
763 nvlist_add_bool(nvl, testkey, testval);
765 ATF_REQUIRE_EQ(nvlist_take_bool(nvl, testkey), testval);
766 ATF_REQUIRE(nvlist_empty(nvl));
768 nvlist_destroy(nvl);
774 nvlist_t *nvl;
779 nvl = nvlist_create(0);
780 ATF_REQUIRE(nvl != NULL);
784 nvlist_add_bool(nvl, testkey, testval);
788 nvlist_add_bool(nvl, otherkey1, otherval1);
792 nvlist_move_nvlist(nvl, otherkey2, otherval2);
794 ATF_REQUIRE_EQ(nvlist_take_bool(nvl, testkey), testval);
796 ATF_REQUIRE(nvlist_exists_bool(nvl, otherkey1));
797 ATF_REQUIRE_EQ(nvlist_get_bool(nvl, otherkey1), otherval1);
799 ATF_REQUIRE(nvlist_exists_nvlist(nvl, otherkey2));
800 verify_test_nvlist(nvlist_get_nvlist(nvl, otherkey2));
802 nvlist_destroy(nvl);
808 nvlist_t *nvl;
812 nvl = nvlist_create(0);
813 ATF_REQUIRE(nvl != NULL);
817 nvlist_add_number(nvl, testkey, testval);
819 ATF_REQUIRE_EQ(nvlist_take_number(nvl, testkey), testval);
820 ATF_REQUIRE(nvlist_empty(nvl));
822 nvlist_destroy(nvl);
828 nvlist_t *nvl;
833 nvl = nvlist_create(0);
834 ATF_REQUIRE(nvl != NULL);
838 nvlist_add_number(nvl, otherkey1, otherval1);
842 nvlist_add_number(nvl, testkey, testval);
846 nvlist_add_string(nvl, otherkey2, otherval2);
848 ATF_REQUIRE_EQ(nvlist_take_number(nvl, testkey), testval);
850 ATF_REQUIRE(nvlist_exists_number(nvl, otherkey1));
851 ATF_REQUIRE_EQ(nvlist_get_number(nvl, otherkey1), otherval1);
853 ATF_REQUIRE(nvlist_exists_string(nvl, otherkey2));
854 ATF_REQUIRE_EQ(strcmp(nvlist_get_string(nvl, otherkey2), otherval2), 0);
856 nvlist_destroy(nvl);
862 nvlist_t *nvl;
866 nvl = nvlist_create(0);
867 ATF_REQUIRE(nvl != NULL);
871 nvlist_add_string(nvl, testkey, testval);
873 ATF_REQUIRE_EQ(strcmp(nvlist_take_string(nvl, testkey), testval), 0);
874 ATF_REQUIRE(nvlist_empty(nvl));
876 nvlist_destroy(nvl);
882 nvlist_t *nvl;
887 nvl = nvlist_create(0);
888 ATF_REQUIRE(nvl != NULL);
892 nvlist_add_string(nvl, otherkey1, otherval1);
896 nvlist_add_bool(nvl, otherkey2, otherval2);
900 nvlist_add_string(nvl, testkey, testval);
902 ATF_REQUIRE_EQ(strcmp(nvlist_take_string(nvl, testkey), testval), 0);
904 ATF_REQUIRE(nvlist_exists_string(nvl, otherkey1));
905 ATF_REQUIRE_EQ(strcmp(nvlist_get_string(nvl, otherkey1), otherval1), 0);
907 ATF_REQUIRE(nvlist_exists_bool(nvl, otherkey2));
908 ATF_REQUIRE_EQ(nvlist_get_bool(nvl, otherkey2), otherval2);
910 nvlist_destroy(nvl);
916 nvlist_t *nvl;
920 nvl = nvlist_create(0);
921 ATF_REQUIRE(nvl != NULL);
925 nvlist_move_nvlist(nvl, testkey, testval);
927 verify_test_nvlist(nvlist_take_nvlist(nvl, testkey));
928 ATF_REQUIRE(nvlist_empty(nvl));
930 nvlist_destroy(nvl);
936 nvlist_t *nvl;
940 nvl = nvlist_create(0);
941 ATF_REQUIRE(nvl != NULL);
945 nvlist_move_nvlist(nvl, testkey, testval);
949 nvlist_move_nvlist(nvl, otherkey1, otherval1);
952 nvlist_add_null(nvl, otherkey2);
954 verify_test_nvlist(nvlist_take_nvlist(nvl, testkey));
956 ATF_REQUIRE(nvlist_exists_nvlist(nvl, otherkey1));
957 ATF_REQUIRE(nvlist_empty(nvlist_get_nvlist(nvl, otherkey1)));
959 ATF_REQUIRE(nvlist_exists_null(nvl, otherkey2));
961 nvlist_destroy(nvl);
967 nvlist_t *nvl;
973 nvl = nvlist_create(0);
974 ATF_REQUIRE(nvl != NULL);
980 nvlist_move_binary(nvl, testkey, testval, testsize);
982 actual_val = nvlist_take_binary(nvl, testkey, &actual_size);
985 ATF_REQUIRE(nvlist_empty(nvl));
987 nvlist_destroy(nvl);
993 nvlist_t *nvl;
1001 nvl = nvlist_create(0);
1002 ATF_REQUIRE(nvl != NULL);
1006 nvlist_add_binary(nvl, otherkey1, otherval1, othersize);
1010 nvlist_add_bool(nvl, otherkey2, otherval2);
1014 nvlist_add_binary(nvl, testkey, testval, testsize);
1016 actual_value = nvlist_take_binary(nvl, testkey, &actual_size);
1020 ATF_REQUIRE(nvlist_exists_binary(nvl, otherkey1));
1021 actual_value = nvlist_get_binary(nvl, otherkey1, &actual_size);
1025 ATF_REQUIRE(nvlist_exists_bool(nvl, otherkey2));
1026 ATF_REQUIRE_EQ(nvlist_get_bool(nvl, otherkey2), otherval2);
1028 nvlist_destroy(nvl);
1034 nvlist_t *nvl;
1037 nvl = nvlist_create(0);
1039 nvlist_add_null(nvl, key);
1041 nvlist_free(nvl, key);
1042 ATF_REQUIRE(nvlist_empty(nvl));
1044 nvlist_destroy(nvl);
1050 nvlist_t *nvl;
1053 nvl = nvlist_create(0);
1055 nvlist_add_bool(nvl, key, true);
1057 nvlist_free(nvl, key);
1058 ATF_REQUIRE(nvlist_empty(nvl));
1060 nvlist_destroy(nvl);
1066 nvlist_t *nvl;
1069 nvl = nvlist_create(0);
1071 nvlist_add_number(nvl, key, 584);
1073 nvlist_free(nvl, key);
1074 ATF_REQUIRE(nvlist_empty(nvl));
1076 nvlist_destroy(nvl);
1082 nvlist_t *nvl;
1085 nvl = nvlist_create(0);
1087 nvlist_add_string(nvl, key, "gjkfkjd");
1089 nvlist_free(nvl, key);
1090 ATF_REQUIRE(nvlist_empty(nvl));
1092 nvlist_destroy(nvl);
1098 nvlist_t *nvl;
1101 nvl = nvlist_create(0);
1103 nvlist_add_nvlist(nvl, key, nvlist_create(0));
1105 nvlist_free(nvl, key);
1106 ATF_REQUIRE(nvlist_empty(nvl));
1108 nvlist_destroy(nvl);
1114 nvlist_t *nvl;
1117 nvl = nvlist_create(0);
1119 nvlist_add_binary(nvl, key, "jgjgfd", 6);
1121 nvlist_free(nvl, key);
1122 ATF_REQUIRE(nvlist_empty(nvl));
1124 nvlist_destroy(nvl);
1130 nvlist_t *nvl;
1133 nvl = nvlist_create(0);
1135 nvlist_add_null(nvl, key);
1137 nvlist_free_null(nvl, key);
1138 ATF_REQUIRE(nvlist_empty(nvl));
1140 nvlist_destroy(nvl);
1146 nvlist_t *nvl;
1149 nvl = nvlist_create(0);
1151 nvlist_add_bool(nvl, key, true);
1153 nvlist_free_bool(nvl, key);
1154 ATF_REQUIRE(nvlist_empty(nvl));
1156 nvlist_destroy(nvl);
1162 nvlist_t *nvl;
1165 nvl = nvlist_create(0);
1167 nvlist_add_number(nvl, key, 584);
1169 nvlist_free_number(nvl, key);
1170 ATF_REQUIRE(nvlist_empty(nvl));
1172 nvlist_destroy(nvl);
1178 nvlist_t *nvl;
1181 nvl = nvlist_create(0);
1183 nvlist_add_string(nvl, key, "gjkfkjd");
1185 nvlist_free_string(nvl, key);
1186 ATF_REQUIRE(nvlist_empty(nvl));
1188 nvlist_destroy(nvl);
1194 nvlist_t *nvl;
1197 nvl = nvlist_create(0);
1199 nvlist_add_nvlist(nvl, key, nvlist_create(0));
1201 nvlist_free_nvlist(nvl, key);
1202 ATF_REQUIRE(nvlist_empty(nvl));
1204 nvlist_destroy(nvl);
1210 nvlist_t *nvl;
1213 nvl = nvlist_create(0);
1215 nvlist_add_binary(nvl, key, "jgjgfd", 6);
1217 nvlist_free_binary(nvl, key);
1218 ATF_REQUIRE(nvlist_empty(nvl));
1220 nvlist_destroy(nvl);