• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /freebsd-12-stable/lib/libnv/tests/

Lines Matching refs:nvl

46 	nvlist_t *nvl;
50 nvl = nvlist_create(0);
52 ATF_REQUIRE(nvl != NULL);
54 ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
55 ATF_REQUIRE(nvlist_empty(nvl));
58 ATF_REQUIRE_EQ(nvlist_next(nvl, &type, &it), static_cast<const char *>(NULL));
60 nvlist_destroy(nvl);
66 nvlist_t *nvl;
72 nvl = nvlist_create(0);
74 ATF_REQUIRE(nvl != NULL);
75 ATF_REQUIRE(!nvlist_exists(nvl, key));
77 nvlist_add_null(nvl, key);
79 ATF_REQUIRE(!nvlist_empty(nvl));
80 ATF_REQUIRE(nvlist_exists(nvl, key));
81 ATF_REQUIRE(nvlist_exists_null(nvl, key));
82 ATF_REQUIRE(nvlist_exists_null(nvl, "key"));
86 ATF_REQUIRE_EQ(strcmp(nvlist_next(nvl, &type, &it), key), 0);
88 ATF_REQUIRE_EQ(nvlist_next(nvl, &type,&it), static_cast<const char *>(NULL));
90 nvlist_destroy(nvl);
96 nvlist_t *nvl;
102 nvl = nvlist_create(0);
104 ATF_REQUIRE(nvl != NULL);
105 ATF_REQUIRE(!nvlist_exists(nvl, key));
107 nvlist_add_bool(nvl, key, true);
109 ATF_REQUIRE(!nvlist_empty(nvl));
110 ATF_REQUIRE(nvlist_exists(nvl, key));
111 ATF_REQUIRE(nvlist_exists(nvl, "name"));
112 ATF_REQUIRE(nvlist_exists_bool(nvl, key));
113 ATF_REQUIRE(nvlist_exists_bool(nvl, "name"));
114 ATF_REQUIRE_EQ(nvlist_get_bool(nvl, key), true);
118 ATF_REQUIRE_EQ(strcmp(nvlist_next(nvl, &type, &it), key), 0);
120 ATF_REQUIRE_EQ(nvlist_next(nvl, &type,&it), static_cast<const char *>(NULL));
122 nvlist_destroy(nvl);
128 nvlist_t *nvl;
136 nvl = nvlist_create(0);
138 ATF_REQUIRE(nvl != NULL);
139 ATF_REQUIRE(!nvlist_exists(nvl, key));
141 nvlist_add_number(nvl, key, value);
143 ATF_REQUIRE(!nvlist_empty(nvl));
144 ATF_REQUIRE(nvlist_exists(nvl, key));
145 ATF_REQUIRE(nvlist_exists(nvl, "foo123"));
146 ATF_REQUIRE(nvlist_exists_number(nvl, key));
147 ATF_REQUIRE_EQ(nvlist_get_number(nvl, key), value);
151 ATF_REQUIRE_EQ(strcmp(nvlist_next(nvl, &type, &it), key), 0);
153 ATF_REQUIRE_EQ(nvlist_next(nvl, &type,&it), static_cast<const char *>(NULL));
155 nvlist_destroy(nvl);
161 nvlist_t *nvl;
169 nvl = nvlist_create(0);
171 ATF_REQUIRE(nvl != NULL);
172 ATF_REQUIRE(!nvlist_exists(nvl, key));
174 nvlist_add_string(nvl, key, value);
176 ATF_REQUIRE(!nvlist_empty(nvl));
177 ATF_REQUIRE(nvlist_exists(nvl, key));
178 ATF_REQUIRE(nvlist_exists(nvl, "test"));
179 ATF_REQUIRE(nvlist_exists_string(nvl, key));
180 ATF_REQUIRE(nvlist_exists_string(nvl, "test"));
181 ATF_REQUIRE_EQ(strcmp(nvlist_get_string(nvl, key), value), 0);
184 ATF_REQUIRE(nvlist_get_string(nvl, key) != value);
188 ATF_REQUIRE_EQ(strcmp(nvlist_next(nvl, &type, &it), key), 0);
190 ATF_REQUIRE_EQ(nvlist_next(nvl, &type,&it), static_cast<const char *>(NULL));
192 nvlist_destroy(nvl);
198 nvlist_t *nvl;
208 nvl = nvlist_create(0);
210 ATF_REQUIRE(nvl != NULL);
211 ATF_REQUIRE(!nvlist_exists(nvl, key));
214 nvlist_add_nvlist(nvl, key, sublist);
216 ATF_REQUIRE(!nvlist_empty(nvl));
217 ATF_REQUIRE(nvlist_exists(nvl, key));
218 ATF_REQUIRE(nvlist_exists(nvl, "test"));
219 ATF_REQUIRE(nvlist_exists_nvlist(nvl, key));
220 ATF_REQUIRE(nvlist_exists_nvlist(nvl, "test"));
222 value = nvlist_get_nvlist(nvl, key);
230 ATF_REQUIRE_EQ(strcmp(nvlist_next(nvl, &type, &it), key), 0);
232 ATF_REQUIRE_EQ(nvlist_next(nvl, &type,&it), static_cast<const char *>(NULL));
235 nvlist_destroy(nvl);
241 nvlist_t *nvl, *parent;
243 nvl = nvlist_create(0);
246 nvlist_set_error(nvl, EBADF);
247 nvlist_add_nvlist(parent, "test", nvl);
250 nvlist_destroy(nvl);
257 nvlist_t *nvl;
269 nvl = nvlist_create(0);
271 ATF_REQUIRE(nvl != NULL);
272 ATF_REQUIRE(!nvlist_exists(nvl, key));
274 nvlist_add_binary(nvl, key, value, value_size);
276 ATF_REQUIRE(!nvlist_empty(nvl));
277 ATF_REQUIRE(nvlist_exists(nvl, key));
278 ATF_REQUIRE(nvlist_exists(nvl, "binary"));
279 ATF_REQUIRE(nvlist_exists_binary(nvl, key));
280 ATF_REQUIRE(nvlist_exists_binary(nvl, "binary"));
282 ret_value = nvlist_get_binary(nvl, key, &ret_size);
291 ATF_REQUIRE_EQ(strcmp(nvlist_next(nvl, &type, &it), key), 0);
293 ATF_REQUIRE_EQ(nvlist_next(nvl, &type,&it), static_cast<const char *>(NULL));
295 nvlist_destroy(nvl);
302 nvlist_t *nvl, *clone;
304 nvl = nvlist_create(0);
305 ATF_REQUIRE(nvl != NULL);
307 clone = nvlist_clone(nvl);
309 ATF_REQUIRE(clone != nvl);
313 nvlist_destroy(nvl);
319 nvlist_t *nvl, *clone;
325 nvl = nvlist_create(0);
326 ATF_REQUIRE(nvl != NULL);
330 nvlist_add_number(nvl, key, value);
332 clone = nvlist_clone(nvl);
334 ATF_REQUIRE(clone != nvl);
345 nvlist_destroy(nvl);
356 nvlist_t *nvl, *sublist;
358 nvl = nvlist_create(0);
359 ATF_REQUIRE(nvl != NULL);
365 nvlist_move_nvlist(nvl, test_subnvlist_key, sublist);
367 return (nvl);
371 verify_test_nvlist(const nvlist_t *nvl)
377 ATF_REQUIRE(nvlist_exists_nvlist(nvl, test_subnvlist_key));
379 value = nvlist_get_nvlist(nvl, test_subnvlist_key);
393 ATF_REQUIRE_EQ(strcmp(nvlist_next(nvl, &type, &it),
396 ATF_REQUIRE_EQ(nvlist_next(nvl, &type, &it), static_cast<const char *>(NULL));
402 nvlist_t *nvl, *clone;
404 nvl = create_test_nvlist();
405 clone = nvlist_clone(nvl);
408 ATF_REQUIRE(clone != nvl);
412 nvlist_destroy(nvl);
418 nvlist_t *nvl, *clone;
420 nvl = nvlist_create(0);
421 ATF_REQUIRE(nvl != NULL);
423 nvlist_set_error(nvl, ENOMEM);
425 clone = nvlist_clone(nvl);
428 nvlist_destroy(nvl);
434 nvlist_t *nvl, *unpacked;
438 nvl = nvlist_create(0);
439 ATF_REQUIRE(nvl != NULL);
441 packed = nvlist_pack(nvl, &packed_size);
446 ATF_REQUIRE(unpacked != nvl);
450 nvlist_destroy(nvl);
457 nvlist_t *nvl, *unpacked;
461 nvl = nvlist_create(NV_FLAG_NO_UNIQUE);
462 ATF_REQUIRE(nvl != NULL);
464 nvlist_add_bool(nvl, "name", true);
465 ATF_REQUIRE(!nvlist_empty(nvl));
466 ATF_REQUIRE(nvlist_exists_bool(nvl, "name"));
468 packed = nvlist_pack(nvl, &packed_size);
479 ATF_REQUIRE(unpacked != nvl);
484 nvlist_destroy(nvl);
489 verify_null(const nvlist_t *nvl, int type)
496 verify_number(const nvlist_t *nvl, const char *name, int type, uint64_t value)
500 ATF_REQUIRE_EQ(nvlist_get_number(nvl, name), value);
504 verify_string(const nvlist_t *nvl, const char *name, int type,
509 ATF_REQUIRE_EQ(strcmp(nvlist_get_string(nvl, name), value), 0);
513 verify_nvlist(const nvlist_t *nvl, const char *name, int type)
517 verify_test_nvlist(nvlist_get_nvlist(nvl, name));
521 verify_binary(const nvlist_t *nvl, const char *name, int type,
528 actual_value = nvlist_get_binary(nvl, name, &actual_size);
538 nvlist_t *nvl, *unpacked, *nvvalue;
546 nvl = nvlist_create(0);
549 nvlist_add_null(nvl, nullkey);
553 nvlist_add_number(nvl, numkey, numvalue);
557 nvlist_add_string(nvl, strkey, strvalue);
561 nvlist_move_nvlist(nvl, nvkey, nvvalue);
567 nvlist_move_binary(nvl, binkey, binvalue, binsize);
569 packed = nvlist_pack(nvl, &packed_size);
601 nvlist_destroy(nvl);
609 nvlist_t *nvl;
613 nvl = nvlist_create(0);
614 ATF_REQUIRE(nvl != NULL);
616 nvlist_set_error(nvl, ENOMEM);
618 packed = nvlist_pack(nvl, &size);
621 nvlist_destroy(nvl);
627 nvlist_t *nvl, *unpacked;
632 nvl = nvlist_create(0);
636 nvlist_add_number(nvl, key1, 5);
640 nvlist_add_number(nvl, key2, 10);
642 packed = nvlist_pack(nvl, &size);
657 nvlist_destroy(nvl);
664 nvlist_t *nvl;
668 nvl = nvlist_create(0);
669 ATF_REQUIRE(nvl != NULL);
675 nvlist_move_string(nvl, key, value);
676 ATF_REQUIRE_EQ(nvlist_get_string(nvl, key), value);
678 nvlist_destroy(nvl);
698 nvlist_t *nvl, *parent;
700 nvl = nvlist_create(0);
703 nvlist_set_error(nvl, EBADF);
704 nvlist_move_nvlist(parent, "test", nvl);
713 nvlist_t *nvl;
717 nvl = nvlist_create(0);
718 ATF_REQUIRE(nvl != NULL);
724 nvlist_move_nvlist(nvl, key, value);
725 ATF_REQUIRE_EQ(nvlist_get_nvlist(nvl, key), value);
727 nvlist_destroy(nvl);
733 nvlist_t *nvl;
738 nvl = nvlist_create(0);
739 ATF_REQUIRE(nvl != NULL);
746 nvlist_move_binary(nvl, key, value, size);
747 ATF_REQUIRE_EQ(nvlist_get_binary(nvl, key, &actual_size), value);
750 nvlist_destroy(nvl);
756 nvlist_t *nvl;
760 nvl = nvlist_create(0);
761 ATF_REQUIRE(nvl != NULL);
765 nvlist_add_bool(nvl, testkey, testval);
767 ATF_REQUIRE_EQ(nvlist_take_bool(nvl, testkey), testval);
768 ATF_REQUIRE(nvlist_empty(nvl));
770 nvlist_destroy(nvl);
776 nvlist_t *nvl;
781 nvl = nvlist_create(0);
782 ATF_REQUIRE(nvl != NULL);
786 nvlist_add_bool(nvl, testkey, testval);
790 nvlist_add_bool(nvl, otherkey1, otherval1);
794 nvlist_move_nvlist(nvl, otherkey2, otherval2);
796 ATF_REQUIRE_EQ(nvlist_take_bool(nvl, testkey), testval);
798 ATF_REQUIRE(nvlist_exists_bool(nvl, otherkey1));
799 ATF_REQUIRE_EQ(nvlist_get_bool(nvl, otherkey1), otherval1);
801 ATF_REQUIRE(nvlist_exists_nvlist(nvl, otherkey2));
802 verify_test_nvlist(nvlist_get_nvlist(nvl, otherkey2));
804 nvlist_destroy(nvl);
810 nvlist_t *nvl;
814 nvl = nvlist_create(0);
815 ATF_REQUIRE(nvl != NULL);
819 nvlist_add_number(nvl, testkey, testval);
821 ATF_REQUIRE_EQ(nvlist_take_number(nvl, testkey), testval);
822 ATF_REQUIRE(nvlist_empty(nvl));
824 nvlist_destroy(nvl);
830 nvlist_t *nvl;
835 nvl = nvlist_create(0);
836 ATF_REQUIRE(nvl != NULL);
840 nvlist_add_number(nvl, otherkey1, otherval1);
844 nvlist_add_number(nvl, testkey, testval);
848 nvlist_add_string(nvl, otherkey2, otherval2);
850 ATF_REQUIRE_EQ(nvlist_take_number(nvl, testkey), testval);
852 ATF_REQUIRE(nvlist_exists_number(nvl, otherkey1));
853 ATF_REQUIRE_EQ(nvlist_get_number(nvl, otherkey1), otherval1);
855 ATF_REQUIRE(nvlist_exists_string(nvl, otherkey2));
856 ATF_REQUIRE_EQ(strcmp(nvlist_get_string(nvl, otherkey2), otherval2), 0);
858 nvlist_destroy(nvl);
864 nvlist_t *nvl;
868 nvl = nvlist_create(0);
869 ATF_REQUIRE(nvl != NULL);
873 nvlist_add_string(nvl, testkey, testval);
875 ATF_REQUIRE_EQ(strcmp(nvlist_take_string(nvl, testkey), testval), 0);
876 ATF_REQUIRE(nvlist_empty(nvl));
878 nvlist_destroy(nvl);
884 nvlist_t *nvl;
889 nvl = nvlist_create(0);
890 ATF_REQUIRE(nvl != NULL);
894 nvlist_add_string(nvl, otherkey1, otherval1);
898 nvlist_add_bool(nvl, otherkey2, otherval2);
902 nvlist_add_string(nvl, testkey, testval);
904 ATF_REQUIRE_EQ(strcmp(nvlist_take_string(nvl, testkey), testval), 0);
906 ATF_REQUIRE(nvlist_exists_string(nvl, otherkey1));
907 ATF_REQUIRE_EQ(strcmp(nvlist_get_string(nvl, otherkey1), otherval1), 0);
909 ATF_REQUIRE(nvlist_exists_bool(nvl, otherkey2));
910 ATF_REQUIRE_EQ(nvlist_get_bool(nvl, otherkey2), otherval2);
912 nvlist_destroy(nvl);
918 nvlist_t *nvl;
922 nvl = nvlist_create(0);
923 ATF_REQUIRE(nvl != NULL);
927 nvlist_move_nvlist(nvl, testkey, testval);
929 verify_test_nvlist(nvlist_take_nvlist(nvl, testkey));
930 ATF_REQUIRE(nvlist_empty(nvl));
932 nvlist_destroy(nvl);
938 nvlist_t *nvl;
942 nvl = nvlist_create(0);
943 ATF_REQUIRE(nvl != NULL);
947 nvlist_move_nvlist(nvl, testkey, testval);
951 nvlist_move_nvlist(nvl, otherkey1, otherval1);
954 nvlist_add_null(nvl, otherkey2);
956 verify_test_nvlist(nvlist_take_nvlist(nvl, testkey));
958 ATF_REQUIRE(nvlist_exists_nvlist(nvl, otherkey1));
959 ATF_REQUIRE(nvlist_empty(nvlist_get_nvlist(nvl, otherkey1)));
961 ATF_REQUIRE(nvlist_exists_null(nvl, otherkey2));
963 nvlist_destroy(nvl);
969 nvlist_t *nvl;
975 nvl = nvlist_create(0);
976 ATF_REQUIRE(nvl != NULL);
982 nvlist_move_binary(nvl, testkey, testval, testsize);
984 actual_val = nvlist_take_binary(nvl, testkey, &actual_size);
987 ATF_REQUIRE(nvlist_empty(nvl));
989 nvlist_destroy(nvl);
995 nvlist_t *nvl;
1003 nvl = nvlist_create(0);
1004 ATF_REQUIRE(nvl != NULL);
1008 nvlist_add_binary(nvl, otherkey1, otherval1, othersize);
1012 nvlist_add_bool(nvl, otherkey2, otherval2);
1016 nvlist_add_binary(nvl, testkey, testval, testsize);
1018 actual_value = nvlist_take_binary(nvl, testkey, &actual_size);
1022 ATF_REQUIRE(nvlist_exists_binary(nvl, otherkey1));
1023 actual_value = nvlist_get_binary(nvl, otherkey1, &actual_size);
1027 ATF_REQUIRE(nvlist_exists_bool(nvl, otherkey2));
1028 ATF_REQUIRE_EQ(nvlist_get_bool(nvl, otherkey2), otherval2);
1030 nvlist_destroy(nvl);
1036 nvlist_t *nvl;
1039 nvl = nvlist_create(0);
1041 nvlist_add_null(nvl, key);
1043 nvlist_free(nvl, key);
1044 ATF_REQUIRE(nvlist_empty(nvl));
1046 nvlist_destroy(nvl);
1052 nvlist_t *nvl;
1055 nvl = nvlist_create(0);
1057 nvlist_add_bool(nvl, key, true);
1059 nvlist_free(nvl, key);
1060 ATF_REQUIRE(nvlist_empty(nvl));
1062 nvlist_destroy(nvl);
1068 nvlist_t *nvl;
1071 nvl = nvlist_create(0);
1073 nvlist_add_number(nvl, key, 584);
1075 nvlist_free(nvl, key);
1076 ATF_REQUIRE(nvlist_empty(nvl));
1078 nvlist_destroy(nvl);
1084 nvlist_t *nvl;
1087 nvl = nvlist_create(0);
1089 nvlist_add_string(nvl, key, "gjkfkjd");
1091 nvlist_free(nvl, key);
1092 ATF_REQUIRE(nvlist_empty(nvl));
1094 nvlist_destroy(nvl);
1100 nvlist_t *nvl;
1103 nvl = nvlist_create(0);
1105 nvlist_add_nvlist(nvl, key, nvlist_create(0));
1107 nvlist_free(nvl, key);
1108 ATF_REQUIRE(nvlist_empty(nvl));
1110 nvlist_destroy(nvl);
1116 nvlist_t *nvl;
1119 nvl = nvlist_create(0);
1121 nvlist_add_binary(nvl, key, "jgjgfd", 6);
1123 nvlist_free(nvl, key);
1124 ATF_REQUIRE(nvlist_empty(nvl));
1126 nvlist_destroy(nvl);
1132 nvlist_t *nvl;
1135 nvl = nvlist_create(0);
1137 nvlist_add_null(nvl, key);
1139 nvlist_free_null(nvl, key);
1140 ATF_REQUIRE(nvlist_empty(nvl));
1142 nvlist_destroy(nvl);
1148 nvlist_t *nvl;
1151 nvl = nvlist_create(0);
1153 nvlist_add_bool(nvl, key, true);
1155 nvlist_free_bool(nvl, key);
1156 ATF_REQUIRE(nvlist_empty(nvl));
1158 nvlist_destroy(nvl);
1164 nvlist_t *nvl;
1167 nvl = nvlist_create(0);
1169 nvlist_add_number(nvl, key, 584);
1171 nvlist_free_number(nvl, key);
1172 ATF_REQUIRE(nvlist_empty(nvl));
1174 nvlist_destroy(nvl);
1180 nvlist_t *nvl;
1183 nvl = nvlist_create(0);
1185 nvlist_add_string(nvl, key, "gjkfkjd");
1187 nvlist_free_string(nvl, key);
1188 ATF_REQUIRE(nvlist_empty(nvl));
1190 nvlist_destroy(nvl);
1196 nvlist_t *nvl;
1199 nvl = nvlist_create(0);
1201 nvlist_add_nvlist(nvl, key, nvlist_create(0));
1203 nvlist_free_nvlist(nvl, key);
1204 ATF_REQUIRE(nvlist_empty(nvl));
1206 nvlist_destroy(nvl);
1212 nvlist_t *nvl;
1215 nvl = nvlist_create(0);
1217 nvlist_add_binary(nvl, key, "jgjgfd", 6);
1219 nvlist_free_binary(nvl, key);
1220 ATF_REQUIRE(nvlist_empty(nvl));
1222 nvlist_destroy(nvl);