Author: oshogbo
Date: Wed Apr 29 22:46:18 2015
New Revision: 282254
URL: https://svnweb.freebsd.org/changeset/base/282254

Log:
  Remove the use of nvlist_.*[fv] functions from tests.
  
  Approved by:  pjd (mentor)

Modified:
  head/lib/libnv/tests/dnv_tests.cc
  head/lib/libnv/tests/nv_tests.cc

Modified: head/lib/libnv/tests/dnv_tests.cc
==============================================================================
--- head/lib/libnv/tests/dnv_tests.cc   Wed Apr 29 22:33:53 2015        
(r282253)
+++ head/lib/libnv/tests/dnv_tests.cc   Wed Apr 29 22:46:18 2015        
(r282254)
@@ -45,7 +45,7 @@ ATF_TEST_CASE_BODY(dnvlist_get_bool__pre
        nvlist_add_bool(nvl, key, value);
 
        ATF_REQUIRE_EQ(dnvlist_get_bool(nvl, key, false), value);
-       ATF_REQUIRE_EQ(dnvlist_getf_bool(nvl, false, "%c%s", 'n', "ame"), 
value);
+       ATF_REQUIRE_EQ(dnvlist_get_bool(nvl, "name", false), value);
 
        nvlist_destroy(nvl);
 }
@@ -60,12 +60,12 @@ ATF_TEST_CASE_BODY(dnvlist_get_bool__def
        nvl = nvlist_create(0);
 
        ATF_REQUIRE_EQ(dnvlist_get_bool(nvl, key, false), false);
-       ATF_REQUIRE_EQ(dnvlist_getf_bool(nvl, true, "%d", 123), true);
+       ATF_REQUIRE_EQ(dnvlist_get_bool(nvl, "123", true), true);
 
        nvlist_add_bool(nvl, key, true);
 
        ATF_REQUIRE_EQ(dnvlist_get_bool(nvl, "otherkey", true), true);
-       ATF_REQUIRE_EQ(dnvlist_getf_bool(nvl, false, "%d%c", 12, 'c'), false);
+       ATF_REQUIRE_EQ(dnvlist_get_bool(nvl, "12c", false), false);
 
        nvlist_destroy(nvl);
 }
@@ -84,7 +84,7 @@ ATF_TEST_CASE_BODY(dnvlist_get_number__p
        nvlist_add_number(nvl, key, value);
 
        ATF_REQUIRE_EQ(dnvlist_get_number(nvl, key, 19), value);
-       ATF_REQUIRE_EQ(dnvlist_getf_number(nvl, 65, "key"), value);
+       ATF_REQUIRE_EQ(dnvlist_get_number(nvl, "key", 65), value);
 
        nvlist_destroy(nvl);
 }
@@ -99,12 +99,11 @@ ATF_TEST_CASE_BODY(dnvlist_get_number__d
        nvl = nvlist_create(0);
 
        ATF_REQUIRE_EQ(dnvlist_get_number(nvl, key, 5), 5);
-       ATF_REQUIRE_EQ(dnvlist_getf_number(nvl, 12, "%s", key), 12);
+       ATF_REQUIRE_EQ(dnvlist_get_number(nvl, "1234", 5), 5);
 
        nvlist_add_number(nvl, key, 24841);
 
-       ATF_REQUIRE_EQ(dnvlist_get_number(nvl, "hthth", 184), 184);
-       ATF_REQUIRE_EQ(dnvlist_getf_number(nvl, 5641, "%d", 1234), 5641);
+       ATF_REQUIRE_EQ(dnvlist_get_number(nvl, "1234", 5641), 5641);
 
        nvlist_destroy(nvl);
 }
@@ -124,7 +123,7 @@ ATF_TEST_CASE_BODY(dnvlist_get_string__p
 
        ATF_REQUIRE_EQ(strcmp(dnvlist_get_string(nvl, key, "g"), value), 0);
 
-       actual_value = dnvlist_getf_string(nvl, "rs", "%s", key);
+       actual_value = dnvlist_get_string(nvl, key, "rs");
        ATF_REQUIRE_EQ(strcmp(actual_value, value), 0);
 
        nvlist_destroy(nvl);
@@ -142,13 +141,13 @@ ATF_TEST_CASE_BODY(dnvlist_get_string__d
 
        ATF_REQUIRE_EQ(strcmp(dnvlist_get_string(nvl, key, "bar"), "bar"), 0);
 
-       actual_value = dnvlist_getf_string(nvl, "d", "%s", key);
+       actual_value = dnvlist_get_string(nvl, key, "d");
        ATF_REQUIRE_EQ(strcmp(actual_value, "d"), 0);
 
        nvlist_add_string(nvl, key, "cxhweh");
 
        ATF_REQUIRE_EQ(strcmp(dnvlist_get_string(nvl, "hthth", "fd"), "fd"), 0);
-       actual_value = dnvlist_getf_string(nvl, "5", "%s", "5");
+       actual_value = dnvlist_get_string(nvl, "5", "5");
        ATF_REQUIRE_EQ(strcmp("5", "5"), 0);
 
        nvlist_destroy(nvl);
@@ -172,10 +171,6 @@ ATF_TEST_CASE_BODY(dnvlist_get_nvlist__p
        ATF_REQUIRE(actual_value != NULL);
        ATF_REQUIRE(nvlist_empty(actual_value));
 
-       actual_value = dnvlist_getf_nvlist(nvl, NULL, "%s", key);
-       ATF_REQUIRE(actual_value != NULL);
-       ATF_REQUIRE(nvlist_empty(actual_value));
-
        nvlist_destroy(nvl);
 }
 
@@ -191,11 +186,10 @@ ATF_TEST_CASE_BODY(dnvlist_get_nvlist__d
        dummy = nvlist_create(0);
 
        ATF_REQUIRE_EQ(dnvlist_get_nvlist(nvl, key, dummy), dummy);
-       ATF_REQUIRE_EQ(dnvlist_getf_nvlist(nvl, dummy, "%s", key), dummy);
 
        nvlist_move_nvlist(nvl, key, nvlist_create(0));
        ATF_REQUIRE_EQ(dnvlist_get_nvlist(nvl, "456", dummy), dummy);
-       ATF_REQUIRE_EQ(dnvlist_getf_nvlist(nvl, dummy, "%s", "gh"), dummy);
+       ATF_REQUIRE_EQ(dnvlist_get_nvlist(nvl, "gh", dummy), dummy);
 
        nvlist_destroy(nvl);
 }
@@ -226,10 +220,6 @@ ATF_TEST_CASE_BODY(dnvlist_get_binary__p
        ATF_REQUIRE_EQ(value_size, actual_size);
        ATF_REQUIRE_EQ(memcmp(actual_value, value, actual_size), 0);
 
-       actual_value = dnvlist_getf_binary(nvl, &actual_size, "g", 1, "%s", k);
-       ATF_REQUIRE_EQ(value_size, actual_size);
-       ATF_REQUIRE_EQ(memcmp(actual_value, value, actual_size), 0);
-
        nvlist_destroy(nvl);
 }
 
@@ -251,8 +241,8 @@ ATF_TEST_CASE_BODY(dnvlist_get_binary__d
        ATF_REQUIRE_EQ(memcmp(actual_value, default_value, actual_size), 0);
 
        set_const_binary_value(default_value, default_size, "atf");
-       actual_value = dnvlist_getf_binary(nvl, &actual_size, default_value,
-           default_size, "%s", key);
+       actual_value = dnvlist_get_binary(nvl, key, &actual_size, default_value,
+           default_size);
        ATF_REQUIRE_EQ(default_size, actual_size);
        ATF_REQUIRE_EQ(memcmp(actual_value, default_value, actual_size), 0);
 
@@ -266,8 +256,8 @@ ATF_TEST_CASE_BODY(dnvlist_get_binary__d
 
        set_const_binary_value(default_value, default_size,
             "rrhgrythtyrtgbrhgrtdsvdfbtjlkul");
-       actual_value = dnvlist_getf_binary(nvl, &actual_size, default_value,
-           default_size, "s");
+       actual_value = dnvlist_get_binary(nvl, "s", &actual_size, default_value,
+           default_size);
        ATF_REQUIRE_EQ(default_size, actual_size);
        ATF_REQUIRE_EQ(memcmp(actual_value, default_value, actual_size), 0);
 

Modified: head/lib/libnv/tests/nv_tests.cc
==============================================================================
--- head/lib/libnv/tests/nv_tests.cc    Wed Apr 29 22:33:53 2015        
(r282253)
+++ head/lib/libnv/tests/nv_tests.cc    Wed Apr 29 22:46:18 2015        
(r282254)
@@ -77,9 +77,8 @@ ATF_TEST_CASE_BODY(nvlist_add_null__sing
 
        ATF_REQUIRE(!nvlist_empty(nvl));
        ATF_REQUIRE(nvlist_exists(nvl, key));
-       ATF_REQUIRE(nvlist_existsf(nvl, "%s", key));
        ATF_REQUIRE(nvlist_exists_null(nvl, key));
-       ATF_REQUIRE(nvlist_existsf_null(nvl, "key"));
+       ATF_REQUIRE(nvlist_exists_null(nvl, "key"));
 
        /* Iterate over the nvlist; ensure that it has only our one key. */
        it = NULL;
@@ -108,11 +107,10 @@ ATF_TEST_CASE_BODY(nvlist_add_bool__sing
 
        ATF_REQUIRE(!nvlist_empty(nvl));
        ATF_REQUIRE(nvlist_exists(nvl, key));
-       ATF_REQUIRE(nvlist_existsf(nvl, "%s%s", "na", "me"));
+       ATF_REQUIRE(nvlist_exists(nvl, "name"));
        ATF_REQUIRE(nvlist_exists_bool(nvl, key));
-       ATF_REQUIRE(nvlist_existsf_bool(nvl, "%s%c", "nam", 'e'));
+       ATF_REQUIRE(nvlist_exists_bool(nvl, "name"));
        ATF_REQUIRE_EQ(nvlist_get_bool(nvl, key), true);
-       ATF_REQUIRE_EQ(nvlist_getf_bool(nvl, "%c%s", 'n', "ame"), true);
 
        /* Iterate over the nvlist; ensure that it has only our one key. */
        it = NULL;
@@ -143,11 +141,9 @@ ATF_TEST_CASE_BODY(nvlist_add_number__si
 
        ATF_REQUIRE(!nvlist_empty(nvl));
        ATF_REQUIRE(nvlist_exists(nvl, key));
-       ATF_REQUIRE(nvlist_existsf(nvl, "%s%d", "foo", 123));
+       ATF_REQUIRE(nvlist_exists(nvl, "foo123"));
        ATF_REQUIRE(nvlist_exists_number(nvl, key));
-       ATF_REQUIRE(nvlist_existsf_number(nvl, "%s", key));
        ATF_REQUIRE_EQ(nvlist_get_number(nvl, key), value);
-       ATF_REQUIRE_EQ(nvlist_getf_number(nvl, "%s", key), value);
 
        /* Iterate over the nvlist; ensure that it has only our one key. */
        it = NULL;
@@ -178,11 +174,10 @@ ATF_TEST_CASE_BODY(nvlist_add_string__si
 
        ATF_REQUIRE(!nvlist_empty(nvl));
        ATF_REQUIRE(nvlist_exists(nvl, key));
-       ATF_REQUIRE(nvlist_existsf(nvl, "%s", key));
+       ATF_REQUIRE(nvlist_exists(nvl, "test"));
        ATF_REQUIRE(nvlist_exists_string(nvl, key));
-       ATF_REQUIRE(nvlist_existsf_string(nvl, "%s", key));
+       ATF_REQUIRE(nvlist_exists_string(nvl, "test"));
        ATF_REQUIRE_EQ(strcmp(nvlist_get_string(nvl, key), value), 0);
-       ATF_REQUIRE_EQ(strcmp(nvlist_getf_string(nvl, "%s", key), value), 0);
 
        /* nvlist_add_* is required to clone the value, so check for that. */
        ATF_REQUIRE(nvlist_get_string(nvl, key) != value);
@@ -219,9 +214,9 @@ ATF_TEST_CASE_BODY(nvlist_add_nvlist__si
 
        ATF_REQUIRE(!nvlist_empty(nvl));
        ATF_REQUIRE(nvlist_exists(nvl, key));
-       ATF_REQUIRE(nvlist_existsf(nvl, "%s", key));
+       ATF_REQUIRE(nvlist_exists(nvl, "test"));
        ATF_REQUIRE(nvlist_exists_nvlist(nvl, key));
-       ATF_REQUIRE(nvlist_existsf_nvlist(nvl, "%s", key));
+       ATF_REQUIRE(nvlist_exists_nvlist(nvl, "test"));
 
        value = nvlist_get_nvlist(nvl, key);
        ATF_REQUIRE(nvlist_exists_null(value, subkey));
@@ -229,10 +224,6 @@ ATF_TEST_CASE_BODY(nvlist_add_nvlist__si
        /* nvlist_add_* is required to clone the value, so check for that. */
        ATF_REQUIRE(sublist != value);
 
-       value = nvlist_getf_nvlist(nvl, "%s", key);
-       ATF_REQUIRE(nvlist_exists_null(value, subkey));
-       ATF_REQUIRE(sublist != value);
-
        /* Iterate over the nvlist; ensure that it has only our one key. */
        it = NULL;
        ATF_REQUIRE_EQ(strcmp(nvlist_next(nvl, &type, &it), key), 0);
@@ -283,9 +274,9 @@ ATF_TEST_CASE_BODY(nvlist_add_binary__si
 
        ATF_REQUIRE(!nvlist_empty(nvl));
        ATF_REQUIRE(nvlist_exists(nvl, key));
-       ATF_REQUIRE(nvlist_existsf(nvl, "%s", key));
+       ATF_REQUIRE(nvlist_exists(nvl, "binary"));
        ATF_REQUIRE(nvlist_exists_binary(nvl, key));
-       ATF_REQUIRE(nvlist_existsf_binary(nvl, "%s", key));
+       ATF_REQUIRE(nvlist_exists_binary(nvl, "binary"));
 
        ret_value = nvlist_get_binary(nvl, key, &ret_size);
        ATF_REQUIRE_EQ(value_size, ret_size);
@@ -294,11 +285,6 @@ ATF_TEST_CASE_BODY(nvlist_add_binary__si
        /* nvlist_add_* is required to clone the value, so check for that. */
        ATF_REQUIRE(value != ret_value);
 
-       ret_value = nvlist_getf_binary(nvl, &ret_size, "%s", key);
-       ATF_REQUIRE_EQ(value_size, ret_size);
-       ATF_REQUIRE_EQ(memcmp(value, ret_value, ret_size), 0);
-       ATF_REQUIRE(value != ret_value);
-
        /* Iterate over the nvlist; ensure that it has only our one key. */
        it = NULL;
        ATF_REQUIRE_EQ(strcmp(nvlist_next(nvl, &type, &it), key), 0);
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to