Values API: split into private and public APIs
[babeltrace.git] / tests / lib / test_bt_values.c
index e001a7bed2653e75e4b3fef236aa6f6bf326d8ed..f047448b095ec2b616a5eb563890028904441399 100644 (file)
@@ -22,6 +22,7 @@
 
 #include <babeltrace/object.h>
 #include <babeltrace/values.h>
+#include <babeltrace/private-values.h>
 #include <babeltrace/assert-internal.h>
 #include <string.h>
 #include "tap/tap.h"
@@ -45,34 +46,37 @@ void test_bool(void)
 {
        int ret;
        bt_bool value;
+       struct bt_private_value *priv_obj;
        struct bt_value *obj;
 
-       obj = bt_value_bool_create();
+       priv_obj = bt_private_value_bool_create();
+       obj = bt_value_borrow_from_private(priv_obj);
        ok(obj && bt_value_is_bool(obj),
-               "bt_value_bool_create() returns a boolean value object");
+               "bt_private_value_bool_create() returns a boolean value object");
 
        value = BT_TRUE;
        ret = bt_value_bool_get(obj, &value);
        ok(!ret && !value, "default boolean value object value is BT_FALSE");
 
-       BT_ASSERT(!bt_value_bool_set(obj, BT_FALSE));
-       ret = bt_value_bool_set(obj, BT_TRUE);
-       ok(!ret, "bt_value_bool_set() succeeds");
+       BT_ASSERT(!bt_private_value_bool_set(priv_obj, BT_FALSE));
+       ret = bt_private_value_bool_set(priv_obj, BT_TRUE);
+       ok(!ret, "bt_private_value_bool_set() succeeds");
        ret = bt_value_bool_get(obj, &value);
-       ok(!ret && value, "bt_value_bool_set() works");
+       ok(!ret && value, "bt_private_value_bool_set() works");
 
-       BT_OBJECT_PUT_REF_AND_RESET(obj);
+       BT_OBJECT_PUT_REF_AND_RESET(priv_obj);
        pass("putting an existing boolean value object does not cause a crash")
 
        value = BT_FALSE;
-       obj = bt_value_bool_create_init(BT_TRUE);
+       priv_obj = bt_private_value_bool_create_init(BT_TRUE);
+       obj = bt_value_borrow_from_private(priv_obj);
        ok(obj && bt_value_is_bool(obj),
-               "bt_value_bool_create_init() returns a boolean value object");
+               "bt_private_value_bool_create_init() returns a boolean value object");
        ret = bt_value_bool_get(obj, &value);
        ok(!ret && value,
-               "bt_value_bool_create_init() sets the appropriate initial value");
+               "bt_private_value_bool_create_init() sets the appropriate initial value");
 
-       BT_OBJECT_PUT_REF_AND_RESET(obj);
+       BT_OBJECT_PUT_REF_AND_RESET(priv_obj);
 }
 
 static
@@ -80,32 +84,35 @@ void test_integer(void)
 {
        int ret;
        int64_t value;
+       struct bt_private_value *priv_obj;
        struct bt_value *obj;
 
-       obj = bt_value_integer_create();
+       priv_obj = bt_private_value_integer_create();
+       obj = bt_value_borrow_from_private(priv_obj);
        ok(obj && bt_value_is_integer(obj),
-               "bt_value_integer_create() returns an integer value object");
+               "bt_private_value_integer_create() returns an integer value object");
 
        value = 1961;
        ret = bt_value_integer_get(obj, &value);
        ok(!ret && value == 0, "default integer value object value is 0");
 
-       ret = bt_value_integer_set(obj, -98765);
-       ok(!ret, "bt_value_integer_set() succeeds");
+       ret = bt_private_integer_bool_set(priv_obj, -98765);
+       ok(!ret, "bt_private_integer_bool_set() succeeds");
        ret = bt_value_integer_get(obj, &value);
-       ok(!ret && value == -98765, "bt_value_integer_set() works");
+       ok(!ret && value == -98765, "bt_private_integer_bool_set() works");
 
-       BT_OBJECT_PUT_REF_AND_RESET(obj);
+       BT_OBJECT_PUT_REF_AND_RESET(priv_obj);
        pass("putting an existing integer value object does not cause a crash")
 
-       obj = bt_value_integer_create_init(321456987);
+       priv_obj = bt_private_value_integer_create_init(321456987);
+       obj = bt_value_borrow_from_private(priv_obj);
        ok(obj && bt_value_is_integer(obj),
-               "bt_value_integer_create_init() returns an integer value object");
+               "bt_private_value_integer_create_init() returns an integer value object");
        ret = bt_value_integer_get(obj, &value);
        ok(!ret && value == 321456987,
-               "bt_value_integer_create_init() sets the appropriate initial value");
+               "bt_private_value_integer_create_init() sets the appropriate initial value");
 
-       BT_OBJECT_PUT_REF_AND_RESET(obj);
+       BT_OBJECT_PUT_REF_AND_RESET(priv_obj);
 }
 
 static
@@ -113,33 +120,36 @@ void test_real(void)
 {
        int ret;
        double value;
+       struct bt_private_value *priv_obj;
        struct bt_value *obj;
 
-       obj = bt_value_real_create();
+       priv_obj = bt_private_value_real_create();
+       obj = bt_value_borrow_from_private(priv_obj);
        ok(obj && bt_value_is_real(obj),
-               "bt_value_real_create() returns a real number value object");
+               "bt_private_value_real_create() returns a real number value object");
 
        value = 17.34;
        ret = bt_value_real_get(obj, &value);
        ok(!ret && value == 0.,
                "default real number value object value is 0");
 
-       ret = bt_value_real_set(obj, -3.1416);
-       ok(!ret, "bt_value_real_set() succeeds");
+       ret = bt_private_value_real_set(priv_obj, -3.1416);
+       ok(!ret, "bt_private_value_real_set() succeeds");
        ret = bt_value_real_get(obj, &value);
-       ok(!ret && value == -3.1416, "bt_value_real_set() works");
+       ok(!ret && value == -3.1416, "bt_private_value_real_set() works");
 
-       BT_OBJECT_PUT_REF_AND_RESET(obj);
+       BT_OBJECT_PUT_REF_AND_RESET(priv_obj);
        pass("putting an existing real number value object does not cause a crash")
 
-       obj = bt_value_real_create_init(33.1649758);
+       priv_obj = bt_private_value_real_create_init(33.1649758);
+       obj = bt_value_borrow_from_private(priv_obj);
        ok(obj && bt_value_is_real(obj),
-               "bt_value_real_create_init() returns a real number value object");
+               "bt_private_value_real_create_init() returns a real number value object");
        ret = bt_value_real_get(obj, &value);
        ok(!ret && value == 33.1649758,
-               "bt_value_real_create_init() sets the appropriate initial value");
+               "bt_private_value_real_create_init() sets the appropriate initial value");
 
-       BT_OBJECT_PUT_REF_AND_RESET(obj);
+       BT_OBJECT_PUT_REF_AND_RESET(priv_obj);
 }
 
 static
@@ -147,33 +157,36 @@ void test_string(void)
 {
        int ret;
        const char *value;
+       struct bt_private_value *priv_obj;
        struct bt_value *obj;
 
-       obj = bt_value_string_create();
+       priv_obj = bt_private_value_string_create();
+       obj = bt_value_borrow_from_private(priv_obj);
        ok(obj && bt_value_is_string(obj),
-               "bt_value_string_create() returns a string value object");
+               "bt_private_value_string_create() returns a string value object");
 
        ret = bt_value_string_get(obj, &value);
        ok(!ret && value && !strcmp(value, ""),
                "default string value object value is \"\"");
 
-       ret = bt_value_string_set(obj, "hello worldz");
-       ok(!ret, "bt_value_string_set() succeeds");
+       ret = bt_private_value_string_set(priv_obj, "hello worldz");
+       ok(!ret, "bt_private_value_string_set() succeeds");
        ret = bt_value_string_get(obj, &value);
        ok(!ret && value && !strcmp(value, "hello worldz"),
                "bt_value_string_get() works");
 
-       BT_OBJECT_PUT_REF_AND_RESET(obj);
+       BT_OBJECT_PUT_REF_AND_RESET(priv_obj);
        pass("putting an existing string value object does not cause a crash")
 
-       obj = bt_value_string_create_init("initial value");
+       priv_obj = bt_private_value_string_create_init("initial value");
+       obj = bt_value_borrow_from_private(priv_obj);
        ok(obj && bt_value_is_string(obj),
-               "bt_value_string_create_init() returns a string value object");
+               "bt_private_value_string_create_init() returns a string value object");
        ret = bt_value_string_get(obj, &value);
        ok(!ret && value && !strcmp(value, "initial value"),
-               "bt_value_string_create_init() sets the appropriate initial value");
+               "bt_private_value_string_create_init() sets the appropriate initial value");
 
-       BT_OBJECT_PUT_REF_AND_RESET(obj);
+       BT_OBJECT_PUT_REF_AND_RESET(priv_obj);
 }
 
 static
@@ -183,27 +196,34 @@ void test_array(void)
        bt_bool bool_value;
        int64_t int_value;
        double real_value;
+       struct bt_private_value *priv_obj;
        struct bt_value *obj;
        const char *string_value;
+       struct bt_private_value *priv_array_obj;
        struct bt_value *array_obj;
 
-       array_obj = bt_value_array_create();
+       priv_array_obj = bt_private_value_array_create();
+       array_obj = bt_value_borrow_from_private(priv_array_obj);
        ok(array_obj && bt_value_is_array(array_obj),
-               "bt_value_array_create() returns an array value object");
+               "bt_private_value_array_create() returns an array value object");
        ok(bt_value_array_is_empty(array_obj),
                "initial array value object size is 0");
 
-       obj = bt_value_integer_create_init(345);
-       ret = bt_value_array_append_element(array_obj, obj);
-       BT_OBJECT_PUT_REF_AND_RESET(obj);
-       obj = bt_value_real_create_init(-17.45);
-       ret |= bt_value_array_append_element(array_obj, obj);
-       BT_OBJECT_PUT_REF_AND_RESET(obj);
-       obj = bt_value_bool_create_init(BT_TRUE);
-       ret |= bt_value_array_append_element(array_obj, obj);
-       BT_OBJECT_PUT_REF_AND_RESET(obj);
-       ret |= bt_value_array_append_element(array_obj, bt_value_null);
-       ok(!ret, "bt_value_array_append_element() succeeds");
+       priv_obj = bt_private_value_integer_create_init(345);
+       obj = bt_value_borrow_from_private(priv_obj);
+       ret = bt_private_value_array_append_element(priv_array_obj, obj);
+       BT_OBJECT_PUT_REF_AND_RESET(priv_obj);
+       priv_obj = bt_private_value_real_create_init(-17.45);
+       obj = bt_value_borrow_from_private(priv_obj);
+       ret |= bt_private_value_array_append_element(priv_array_obj, obj);
+       BT_OBJECT_PUT_REF_AND_RESET(priv_obj);
+       priv_obj = bt_private_value_bool_create_init(BT_TRUE);
+       obj = bt_value_borrow_from_private(priv_obj);
+       ret |= bt_private_value_array_append_element(priv_array_obj, obj);
+       BT_OBJECT_PUT_REF_AND_RESET(priv_obj);
+       ret |= bt_private_value_array_append_element(priv_array_obj,
+               bt_value_null);
+       ok(!ret, "bt_private_value_array_append_element() succeeds");
        ok(bt_value_array_get_size(array_obj) == 4,
                "appending an element to an array value object increment its size");
 
@@ -229,11 +249,12 @@ void test_array(void)
        ok(obj == bt_value_null,
                "bt_value_array_borrow_element_by_index() returns an value object with the appropriate type (null)");
 
-       obj = bt_value_integer_create_init(1001);
+       priv_obj = bt_private_value_integer_create_init(1001);
+       obj = bt_value_borrow_from_private(priv_obj);
        BT_ASSERT(obj);
-       ok(!bt_value_array_set_element_by_index(array_obj, 2, obj),
+       ok(!bt_private_value_array_set_element_by_index(priv_array_obj, 2, obj),
                "bt_value_array_set_element_by_index() succeeds");
-       BT_OBJECT_PUT_REF_AND_RESET(obj);
+       BT_OBJECT_PUT_REF_AND_RESET(priv_obj);
        obj = bt_value_array_borrow_element_by_index(array_obj, 2);
        ok(obj && bt_value_is_integer(obj),
                "bt_value_array_set_element_by_index() inserts an value object with the appropriate type");
@@ -242,60 +263,64 @@ void test_array(void)
        ok(int_value == 1001,
                "bt_value_array_set_element_by_index() inserts an value object with the appropriate value");
 
-       ret = bt_value_array_append_bool_element(array_obj, BT_FALSE);
-       ok(!ret, "bt_value_array_append_bool_element() succeeds");
-       ret = bt_value_array_append_integer_element(array_obj, 98765);
-       ok(!ret, "bt_value_array_append_integer_element() succeeds");
-       ret = bt_value_array_append_real_element(array_obj, 2.49578);
-       ok(!ret, "bt_value_array_append_real_element() succeeds");
-       ret = bt_value_array_append_string_element(array_obj, "bt_value");
-       ok(!ret, "bt_value_array_append_string_element() succeeds");
-       ret = bt_value_array_append_empty_array_element(array_obj);
-       ok(!ret, "bt_value_array_append_empty_array_element() succeeds");
-       ret = bt_value_array_append_empty_map_element(array_obj);
-       ok(!ret, "bt_value_array_append_empty_map_element() succeeds");
+       ret = bt_private_value_array_append_bool_element(priv_array_obj,
+               BT_FALSE);
+       ok(!ret, "bt_private_value_array_append_bool_element() succeeds");
+       ret = bt_private_value_array_append_integer_element(priv_array_obj,
+               98765);
+       ok(!ret, "bt_private_value_array_append_integer_element() succeeds");
+       ret = bt_private_value_array_append_real_element(priv_array_obj,
+               2.49578);
+       ok(!ret, "bt_private_value_array_append_real_element() succeeds");
+       ret = bt_private_value_array_append_string_element(priv_array_obj,
+               "bt_value");
+       ok(!ret, "bt_private_value_array_append_string_element() succeeds");
+       ret = bt_private_value_array_append_empty_array_element(priv_array_obj);
+       ok(!ret, "bt_private_value_array_append_empty_array_element() succeeds");
+       ret = bt_private_value_array_append_empty_map_element(priv_array_obj);
+       ok(!ret, "bt_private_value_array_append_empty_map_element() succeeds");
 
        ok(bt_value_array_get_size(array_obj) == 10,
-               "the bt_value_array_append_element_*() functions increment the array value object's size");
+               "the bt_private_value_array_append_element_*() functions increment the array value object's size");
        ok(!bt_value_array_is_empty(array_obj),
                "map value object is not empty");
 
        obj = bt_value_array_borrow_element_by_index(array_obj, 4);
        ok(obj && bt_value_is_bool(obj),
-               "bt_value_array_append_bool_element() appends a boolean value object");
+               "bt_private_value_array_append_bool_element() appends a boolean value object");
        ret = bt_value_bool_get(obj, &bool_value);
        ok(!ret && !bool_value,
-               "bt_value_array_append_bool_element() appends the appropriate value");
+               "bt_private_value_array_append_bool_element() appends the appropriate value");
        obj = bt_value_array_borrow_element_by_index(array_obj, 5);
        ok(obj && bt_value_is_integer(obj),
-               "bt_value_array_append_integer_element() appends an integer value object");
+               "bt_private_value_array_append_integer_element() appends an integer value object");
        ret = bt_value_integer_get(obj, &int_value);
        ok(!ret && int_value == 98765,
-               "bt_value_array_append_integer_element() appends the appropriate value");
+               "bt_private_value_array_append_integer_element() appends the appropriate value");
        obj = bt_value_array_borrow_element_by_index(array_obj, 6);
        ok(obj && bt_value_is_real(obj),
-               "bt_value_array_append_real_element() appends a real number value object");
+               "bt_private_value_array_append_real_element() appends a real number value object");
        ret = bt_value_real_get(obj, &real_value);
        ok(!ret && real_value == 2.49578,
-               "bt_value_array_append_real_element() appends the appropriate value");
+               "bt_private_value_array_append_real_element() appends the appropriate value");
        obj = bt_value_array_borrow_element_by_index(array_obj, 7);
        ok(obj && bt_value_is_string(obj),
-               "bt_value_array_append_string_element() appends a string value object");
+               "bt_private_value_array_append_string_element() appends a string value object");
        ret = bt_value_string_get(obj, &string_value);
        ok(!ret && string_value && !strcmp(string_value, "bt_value"),
-               "bt_value_array_append_string_element() appends the appropriate value");
+               "bt_private_value_array_append_string_element() appends the appropriate value");
        obj = bt_value_array_borrow_element_by_index(array_obj, 8);
        ok(obj && bt_value_is_array(obj),
-               "bt_value_array_append_empty_array_element() appends an array value object");
+               "bt_private_value_array_append_empty_array_element() appends an array value object");
        ok(bt_value_array_is_empty(obj),
-               "bt_value_array_append_empty_array_element() an empty array value object");
+               "bt_private_value_array_append_empty_array_element() an empty array value object");
        obj = bt_value_array_borrow_element_by_index(array_obj, 9);
        ok(obj && bt_value_is_map(obj),
-               "bt_value_array_append_empty_map_element() appends a map value object");
+               "bt_private_value_array_append_empty_map_element() appends a map value object");
        ok(bt_value_map_is_empty(obj),
-               "bt_value_array_append_empty_map_element() an empty map value object");
+               "bt_private_value_array_append_empty_map_element() an empty map value object");
 
-       BT_OBJECT_PUT_REF_AND_RESET(array_obj);
+       BT_OBJECT_PUT_REF_AND_RESET(priv_array_obj);
        pass("putting an existing array value object does not cause a crash")
 }
 
@@ -472,7 +497,8 @@ bt_bool test_map_foreach_cb_check(const char *key, struct bt_value *object,
                        checklist->map2 = BT_TRUE;
                }
        } else {
-               fail("test_map_foreach_cb_check(): unknown map key \"%s\"", key);
+               fail("test_map_foreach_cb_check(): unknown map key \"%s\"",
+                       key);
        }
 
        return BT_TRUE;
@@ -486,34 +512,42 @@ void test_map(void)
        bt_bool bool_value;
        int64_t int_value;
        double real_value;
+       struct bt_private_value *priv_obj;
        struct bt_value *obj;
+       struct bt_private_value *priv_map_obj;
        struct bt_value *map_obj;
        struct map_foreach_checklist checklist;
 
-       map_obj = bt_value_map_create();
+       priv_map_obj = bt_private_value_map_create();
+       map_obj = bt_value_borrow_from_private(priv_map_obj);
        ok(map_obj && bt_value_is_map(map_obj),
-               "bt_value_map_create() returns a map value object");
+               "bt_private_value_map_create() returns a map value object");
        ok(bt_value_map_get_size(map_obj) == 0,
                "initial map value object size is 0");
 
-       obj = bt_value_integer_create_init(19457);
-       ret = bt_value_map_insert_entry(map_obj, "int", obj);
-       BT_OBJECT_PUT_REF_AND_RESET(obj);
-       obj = bt_value_real_create_init(5.444);
-       ret |= bt_value_map_insert_entry(map_obj, "real", obj);
-       BT_OBJECT_PUT_REF_AND_RESET(obj);
-       obj = bt_value_bool_create();
-       ret |= bt_value_map_insert_entry(map_obj, "bt_bool", obj);
-       BT_OBJECT_PUT_REF_AND_RESET(obj);
-       ret |= bt_value_map_insert_entry(map_obj, "null", bt_value_null);
-       ok(!ret, "bt_value_map_insert_entry() succeeds");
+       priv_obj = bt_private_value_integer_create_init(19457);
+       obj = bt_value_borrow_from_private(priv_obj);
+       ret = bt_private_value_map_insert_entry(priv_map_obj, "int", obj);
+       BT_OBJECT_PUT_REF_AND_RESET(priv_obj);
+       priv_obj = bt_private_value_real_create_init(5.444);
+       obj = bt_value_borrow_from_private(priv_obj);
+       ret |= bt_private_value_map_insert_entry(priv_map_obj, "real", obj);
+       BT_OBJECT_PUT_REF_AND_RESET(priv_obj);
+       priv_obj = bt_private_value_bool_create();
+       obj = bt_value_borrow_from_private(priv_obj);
+       ret |= bt_private_value_map_insert_entry(priv_map_obj, "bt_bool", obj);
+       BT_OBJECT_PUT_REF_AND_RESET(priv_obj);
+       ret |= bt_private_value_map_insert_entry(priv_map_obj, "null",
+               bt_value_null);
+       ok(!ret, "bt_private_value_map_insert_entry() succeeds");
        ok(bt_value_map_get_size(map_obj) == 4,
                "inserting an element into a map value object increment its size");
 
-       obj = bt_value_bool_create_init(BT_TRUE);
-       ret = bt_value_map_insert_entry(map_obj, "bt_bool", obj);
-       BT_OBJECT_PUT_REF_AND_RESET(obj);
-       ok(!ret, "bt_value_map_insert_entry() accepts an existing key");
+       priv_obj = bt_private_value_bool_create_init(BT_TRUE);
+       obj = bt_value_borrow_from_private(priv_obj);
+       ret = bt_private_value_map_insert_entry(priv_map_obj, "bt_bool", obj);
+       BT_OBJECT_PUT_REF_AND_RESET(priv_obj);
+       ok(!ret, "bt_private_value_map_insert_entry() accepts an existing key");
 
        obj = bt_value_map_borrow_entry_value(map_obj, "life");
        ok(!obj, "bt_value_map_borrow_entry_value() returns NULL with an non existing key");
@@ -539,18 +573,23 @@ void test_map(void)
        ok(!ret && bool_value,
                "bt_value_map_borrow_entry_value() returns an value object with the appropriate value (boolean)");
 
-       ret = bt_value_map_insert_bool_entry(map_obj, "bool2", BT_TRUE);
-       ok(!ret, "bt_value_map_insert_bool_entry() succeeds");
-       ret = bt_value_map_insert_integer_entry(map_obj, "int2", 98765);
-       ok(!ret, "bt_value_map_insert_integer_entry() succeeds");
-       ret = bt_value_map_insert_real_entry(map_obj, "real2", -49.0001);
-       ok(!ret, "bt_value_map_insert_real_entry() succeeds");
-       ret = bt_value_map_insert_string_entry(map_obj, "string2", "bt_value");
-       ok(!ret, "bt_value_map_insert_string_entry() succeeds");
-       ret = bt_value_map_insert_empty_array_entry(map_obj, "array2");
-       ok(!ret, "bt_value_map_insert_empty_array_entry() succeeds");
-       ret = bt_value_map_insert_empty_map_entry(map_obj, "map2");
-       ok(!ret, "bt_value_map_insert_empty_map_entry() succeeds");
+       ret = bt_private_value_map_insert_bool_entry(priv_map_obj, "bool2",
+               BT_TRUE);
+       ok(!ret, "bt_private_value_map_insert_bool_entry() succeeds");
+       ret = bt_private_value_map_insert_integer_entry(priv_map_obj, "int2",
+               98765);
+       ok(!ret, "bt_private_value_map_insert_integer_entry() succeeds");
+       ret = bt_private_value_map_insert_real_entry(priv_map_obj, "real2",
+               -49.0001);
+       ok(!ret, "bt_private_value_map_insert_real_entry() succeeds");
+       ret = bt_private_value_map_insert_string_entry(priv_map_obj, "string2",
+               "bt_value");
+       ok(!ret, "bt_private_value_map_insert_string_entry() succeeds");
+       ret = bt_private_value_map_insert_empty_array_entry(priv_map_obj,
+               "array2");
+       ok(!ret, "bt_private_value_map_insert_empty_array_entry() succeeds");
+       ret = bt_private_value_map_insert_empty_map_entry(priv_map_obj, "map2");
+       ok(!ret, "bt_private_value_map_insert_empty_map_entry() succeeds");
 
        ok(bt_value_map_get_size(map_obj) == 10,
                "the bt_value_map_insert*() functions increment the map value object's size");
@@ -578,7 +617,8 @@ void test_map(void)
        ok(bt_value_map_has_entry(map_obj, "map2"),
                "map value object has key \"map2\"");
 
-       ret = bt_value_map_foreach_entry(map_obj, test_map_foreach_cb_count, &count);
+       ret = bt_value_map_foreach_entry(map_obj, test_map_foreach_cb_count,
+               &count);
        ok(ret == BT_VALUE_STATUS_CANCELED && count == 3,
                "bt_value_map_foreach_entry() breaks the loop when the user function returns BT_FALSE");
 
@@ -593,7 +633,7 @@ void test_map(void)
                checklist.array2 && checklist.map2,
                "bt_value_map_foreach_entry() iterates over all the map value object's elements");
 
-       BT_OBJECT_PUT_REF_AND_RESET(map_obj);
+       BT_OBJECT_PUT_REF_AND_RESET(priv_map_obj);
        pass("putting an existing map value object does not cause a crash")
 }
 
@@ -619,16 +659,22 @@ void test_compare_null(void)
 static
 void test_compare_bool(void)
 {
-       struct bt_value *bool1 = bt_value_bool_create_init(BT_FALSE);
-       struct bt_value *bool2 = bt_value_bool_create_init(BT_TRUE);
-       struct bt_value *bool3 = bt_value_bool_create_init(BT_FALSE);
+       struct bt_private_value *bool1 =
+               bt_private_value_bool_create_init(BT_FALSE);
+       struct bt_private_value *bool2 =
+               bt_private_value_bool_create_init(BT_TRUE);
+       struct bt_private_value *bool3 =
+               bt_private_value_bool_create_init(BT_FALSE);
 
        BT_ASSERT(bool1 && bool2 && bool3);
-       ok(!bt_value_compare(bt_value_null, bool1),
+       ok(!bt_value_compare(bt_value_null,
+               bt_value_borrow_from_private(bool1)),
                "cannot compare null value object and bt_bool value object");
-       ok(!bt_value_compare(bool1, bool2),
+       ok(!bt_value_compare(bt_value_borrow_from_private(bool1),
+               bt_value_borrow_from_private(bool2)),
                "boolean value objects are not equivalent (BT_FALSE and BT_TRUE)");
-       ok(bt_value_compare(bool1, bool3),
+       ok(bt_value_compare(bt_value_borrow_from_private(bool1),
+               bt_value_borrow_from_private(bool3)),
                "boolean value objects are equivalent (BT_FALSE and BT_FALSE)");
 
        BT_OBJECT_PUT_REF_AND_RESET(bool1);
@@ -639,16 +685,22 @@ void test_compare_bool(void)
 static
 void test_compare_integer(void)
 {
-       struct bt_value *int1 = bt_value_integer_create_init(10);
-       struct bt_value *int2 = bt_value_integer_create_init(-23);
-       struct bt_value *int3 = bt_value_integer_create_init(10);
+       struct bt_private_value *int1 =
+               bt_private_value_integer_create_init(10);
+       struct bt_private_value *int2 =
+               bt_private_value_integer_create_init(-23);
+       struct bt_private_value *int3 =
+               bt_private_value_integer_create_init(10);
 
        BT_ASSERT(int1 && int2 && int3);
-       ok(!bt_value_compare(bt_value_null, int1),
+       ok(!bt_value_compare(bt_value_null,
+               bt_value_borrow_from_private(int1)),
                "cannot compare null value object and integer value object");
-       ok(!bt_value_compare(int1, int2),
+       ok(!bt_value_compare(bt_value_borrow_from_private(int1),
+               bt_value_borrow_from_private(int2)),
                "integer value objects are not equivalent (10 and -23)");
-       ok(bt_value_compare(int1, int3),
+       ok(bt_value_compare(bt_value_borrow_from_private(int1),
+               bt_value_borrow_from_private(int3)),
                "integer value objects are equivalent (10 and 10)");
 
        BT_OBJECT_PUT_REF_AND_RESET(int1);
@@ -659,17 +711,23 @@ void test_compare_integer(void)
 static
 void test_compare_real(void)
 {
-       struct bt_value *real1 = bt_value_real_create_init(17.38);
-       struct bt_value *real2 = bt_value_real_create_init(-14.23);
-       struct bt_value *real3 = bt_value_real_create_init(17.38);
+       struct bt_private_value *real1 =
+               bt_private_value_real_create_init(17.38);
+       struct bt_private_value *real2 =
+               bt_private_value_real_create_init(-14.23);
+       struct bt_private_value *real3 =
+               bt_private_value_real_create_init(17.38);
 
        BT_ASSERT(real1 && real2 && real3);
 
-       ok(!bt_value_compare(bt_value_null, real1),
+       ok(!bt_value_compare(bt_value_null,
+               bt_value_borrow_from_private(real1)),
                "cannot compare null value object and real number value object");
-       ok(!bt_value_compare(real1, real2),
+       ok(!bt_value_compare(bt_value_borrow_from_private(real1),
+               bt_value_borrow_from_private(real2)),
                "real number value objects are not equivalent (17.38 and -14.23)");
-       ok(bt_value_compare(real1, real3),
+       ok(bt_value_compare(bt_value_borrow_from_private(real1),
+               bt_value_borrow_from_private(real3)),
                "real number value objects are equivalent (17.38 and 17.38)");
 
        BT_OBJECT_PUT_REF_AND_RESET(real1);
@@ -680,17 +738,23 @@ void test_compare_real(void)
 static
 void test_compare_string(void)
 {
-       struct bt_value *string1 = bt_value_string_create_init("hello");
-       struct bt_value *string2 = bt_value_string_create_init("bt_value");
-       struct bt_value *string3 = bt_value_string_create_init("hello");
+       struct bt_private_value *string1 =
+               bt_private_value_string_create_init("hello");
+       struct bt_private_value *string2 =
+               bt_private_value_string_create_init("bt_value");
+       struct bt_private_value *string3 =
+               bt_private_value_string_create_init("hello");
 
        BT_ASSERT(string1 && string2 && string3);
 
-       ok(!bt_value_compare(bt_value_null, string1),
+       ok(!bt_value_compare(bt_value_null,
+               bt_value_borrow_from_private(string1)),
                "cannot compare null value object and string value object");
-       ok(!bt_value_compare(string1, string2),
+       ok(!bt_value_compare(bt_value_borrow_from_private(string1),
+               bt_value_borrow_from_private(string2)),
                "string value objects are not equivalent (\"hello\" and \"bt_value\")");
-       ok(bt_value_compare(string1, string3),
+       ok(bt_value_compare(bt_value_borrow_from_private(string1),
+               bt_value_borrow_from_private(string3)),
                "string value objects are equivalent (\"hello\" and \"hello\")");
 
        BT_OBJECT_PUT_REF_AND_RESET(string1);
@@ -701,33 +765,50 @@ void test_compare_string(void)
 static
 void test_compare_array(void)
 {
-       struct bt_value *array1 = bt_value_array_create();
-       struct bt_value *array2 = bt_value_array_create();
-       struct bt_value *array3 = bt_value_array_create();
+       struct bt_private_value *array1 = bt_private_value_array_create();
+       struct bt_private_value *array2 = bt_private_value_array_create();
+       struct bt_private_value *array3 = bt_private_value_array_create();
+       enum bt_value_status status;
 
        BT_ASSERT(array1 && array2 && array3);
 
-       ok(bt_value_compare(array1, array2),
+       ok(bt_value_compare(bt_value_borrow_from_private(array1),
+               bt_value_borrow_from_private(array2)),
                "empty array value objects are equivalent");
 
-       BT_ASSERT(!bt_value_array_append_integer_element(array1, 23));
-       BT_ASSERT(!bt_value_array_append_real_element(array1, 14.2));
-       BT_ASSERT(!bt_value_array_append_bool_element(array1, BT_FALSE));
-       BT_ASSERT(!bt_value_array_append_real_element(array2, 14.2));
-       BT_ASSERT(!bt_value_array_append_integer_element(array2, 23));
-       BT_ASSERT(!bt_value_array_append_bool_element(array2, BT_FALSE));
-       BT_ASSERT(!bt_value_array_append_integer_element(array3, 23));
-       BT_ASSERT(!bt_value_array_append_real_element(array3, 14.2));
-       BT_ASSERT(!bt_value_array_append_bool_element(array3, BT_FALSE));
-       BT_ASSERT(bt_value_array_get_size(array1) == 3);
-       BT_ASSERT(bt_value_array_get_size(array2) == 3);
-       BT_ASSERT(bt_value_array_get_size(array3) == 3);
-
-       ok(!bt_value_compare(bt_value_null, array1),
+       status = bt_private_value_array_append_integer_element(array1, 23);
+       BT_ASSERT(status == BT_VALUE_STATUS_OK);
+       status = bt_private_value_array_append_real_element(array1, 14.2);
+       BT_ASSERT(status == BT_VALUE_STATUS_OK);
+       status = bt_private_value_array_append_bool_element(array1, BT_FALSE);
+       BT_ASSERT(status == BT_VALUE_STATUS_OK);
+       status = bt_private_value_array_append_real_element(array2, 14.2);
+       BT_ASSERT(status == BT_VALUE_STATUS_OK);
+       status = bt_private_value_array_append_integer_element(array2, 23);
+       BT_ASSERT(status == BT_VALUE_STATUS_OK);
+       status = bt_private_value_array_append_bool_element(array2, BT_FALSE);
+       BT_ASSERT(status == BT_VALUE_STATUS_OK);
+       status = bt_private_value_array_append_integer_element(array3, 23);
+       BT_ASSERT(status == BT_VALUE_STATUS_OK);
+       status = bt_private_value_array_append_real_element(array3, 14.2);
+       BT_ASSERT(status == BT_VALUE_STATUS_OK);
+       status = bt_private_value_array_append_bool_element(array3, BT_FALSE);
+       BT_ASSERT(status == BT_VALUE_STATUS_OK);
+       BT_ASSERT(bt_value_array_get_size(
+               bt_value_borrow_from_private(array1)) == 3);
+       BT_ASSERT(bt_value_array_get_size(
+               bt_value_borrow_from_private(array2)) == 3);
+       BT_ASSERT(bt_value_array_get_size(
+               bt_value_borrow_from_private(array3)) == 3);
+
+       ok(!bt_value_compare(bt_value_null,
+               bt_value_borrow_from_private(array1)),
                "cannot compare null value object and array value object");
-       ok(!bt_value_compare(array1, array2),
+       ok(!bt_value_compare(bt_value_borrow_from_private(array1),
+               bt_value_borrow_from_private(array2)),
                "array value objects are not equivalent ([23, 14.2, BT_FALSE] and [14.2, 23, BT_FALSE])");
-       ok(bt_value_compare(array1, array3),
+       ok(bt_value_compare(bt_value_borrow_from_private(array1),
+               bt_value_borrow_from_private(array3)),
                "array value objects are equivalent ([23, 14.2, BT_FALSE] and [23, 14.2, BT_FALSE])");
 
        BT_OBJECT_PUT_REF_AND_RESET(array1);
@@ -738,33 +819,54 @@ void test_compare_array(void)
 static
 void test_compare_map(void)
 {
-       struct bt_value *map1 = bt_value_map_create();
-       struct bt_value *map2 = bt_value_map_create();
-       struct bt_value *map3 = bt_value_map_create();
+       struct bt_private_value *map1 = bt_private_value_map_create();
+       struct bt_private_value *map2 = bt_private_value_map_create();
+       struct bt_private_value *map3 = bt_private_value_map_create();
+       enum bt_value_status status;
 
        BT_ASSERT(map1 && map2 && map3);
 
-       ok(bt_value_compare(map1, map2),
+       ok(bt_value_compare(bt_value_borrow_from_private(map1),
+               bt_value_borrow_from_private(map2)),
                "empty map value objects are equivalent");
 
-       BT_ASSERT(!bt_value_map_insert_integer_entry(map1, "one", 23));
-       BT_ASSERT(!bt_value_map_insert_real_entry(map1, "two", 14.2));
-       BT_ASSERT(!bt_value_map_insert_bool_entry(map1, "three", BT_FALSE));
-       BT_ASSERT(!bt_value_map_insert_real_entry(map2, "one", 14.2));
-       BT_ASSERT(!bt_value_map_insert_integer_entry(map2, "two", 23));
-       BT_ASSERT(!bt_value_map_insert_bool_entry(map2, "three", BT_FALSE));
-       BT_ASSERT(!bt_value_map_insert_bool_entry(map3, "three", BT_FALSE));
-       BT_ASSERT(!bt_value_map_insert_integer_entry(map3, "one", 23));
-       BT_ASSERT(!bt_value_map_insert_real_entry(map3, "two", 14.2));
-       BT_ASSERT(bt_value_map_get_size(map1) == 3);
-       BT_ASSERT(bt_value_map_get_size(map2) == 3);
-       BT_ASSERT(bt_value_map_get_size(map3) == 3);
-
-       ok(!bt_value_compare(bt_value_null, map1),
+
+       status = bt_private_value_map_insert_integer_entry(map1, "one", 23);
+       BT_ASSERT(status == BT_VALUE_STATUS_OK);
+       status = bt_private_value_map_insert_real_entry(map1, "two", 14.2);
+       BT_ASSERT(status == BT_VALUE_STATUS_OK);
+       status = bt_private_value_map_insert_bool_entry(map1, "three",
+               BT_FALSE);
+       BT_ASSERT(status == BT_VALUE_STATUS_OK);
+       status = bt_private_value_map_insert_real_entry(map2, "one", 14.2);
+       BT_ASSERT(status == BT_VALUE_STATUS_OK);
+       status = bt_private_value_map_insert_integer_entry(map2, "two", 23);
+       BT_ASSERT(status == BT_VALUE_STATUS_OK);
+       status = bt_private_value_map_insert_bool_entry(map2, "three",
+               BT_FALSE);
+       BT_ASSERT(status == BT_VALUE_STATUS_OK);
+       status = bt_private_value_map_insert_bool_entry(map3, "three",
+               BT_FALSE);
+       BT_ASSERT(status == BT_VALUE_STATUS_OK);
+       status = bt_private_value_map_insert_integer_entry(map3, "one", 23);
+       BT_ASSERT(status == BT_VALUE_STATUS_OK);
+       status = bt_private_value_map_insert_real_entry(map3, "two", 14.2);
+       BT_ASSERT(status == BT_VALUE_STATUS_OK);
+       BT_ASSERT(bt_value_map_get_size(
+               bt_value_borrow_from_private(map1)) == 3);
+       BT_ASSERT(bt_value_map_get_size(
+               bt_value_borrow_from_private(map2)) == 3);
+       BT_ASSERT(bt_value_map_get_size(
+               bt_value_borrow_from_private(map3)) == 3);
+
+       ok(!bt_value_compare(bt_value_null,
+               bt_value_borrow_from_private(map1)),
                "cannot compare null value object and map value object");
-       ok(!bt_value_compare(map1, map2),
+       ok(!bt_value_compare(bt_value_borrow_from_private(map1),
+               bt_value_borrow_from_private(map2)),
                "map value objects are not equivalent");
-       ok(bt_value_compare(map1, map3),
+       ok(bt_value_compare(bt_value_borrow_from_private(map1),
+               bt_value_borrow_from_private(map3)),
                "map value objects are equivalent");
 
        BT_OBJECT_PUT_REF_AND_RESET(map1);
@@ -795,57 +897,77 @@ void test_copy(void)
         * bt_value_compare() elsewhere, then the deep copy is a
         * success.
         */
-       struct bt_value *null_copy_obj;
-       struct bt_value *bool_obj, *bool_copy_obj;
-       struct bt_value *integer_obj, *integer_copy_obj;
-       struct bt_value *real_obj, *real_copy_obj;
-       struct bt_value *string_obj, *string_copy_obj;
-       struct bt_value *array_obj, *array_copy_obj;
-       struct bt_value *map_obj, *map_copy_obj;
-
-       bool_obj = bt_value_bool_create_init(BT_TRUE);
-       integer_obj = bt_value_integer_create_init(23);
-       real_obj = bt_value_real_create_init(-3.1416);
-       string_obj = bt_value_string_create_init("test");
-       array_obj = bt_value_array_create();
-       map_obj = bt_value_map_create();
+       struct bt_private_value *null_copy_obj;
+       struct bt_private_value *bool_obj, *bool_copy_obj;
+       struct bt_private_value *integer_obj, *integer_copy_obj;
+       struct bt_private_value *real_obj, *real_copy_obj;
+       struct bt_private_value *string_obj, *string_copy_obj;
+       struct bt_private_value *array_obj, *array_copy_obj;
+       struct bt_private_value *map_obj, *map_copy_obj;
+       enum bt_value_status status;
+
+       bool_obj = bt_private_value_bool_create_init(BT_TRUE);
+       integer_obj = bt_private_value_integer_create_init(23);
+       real_obj = bt_private_value_real_create_init(-3.1416);
+       string_obj = bt_private_value_string_create_init("test");
+       array_obj = bt_private_value_array_create();
+       map_obj = bt_private_value_map_create();
 
        BT_ASSERT(bool_obj && integer_obj && real_obj && string_obj &&
                array_obj && map_obj);
 
-       BT_ASSERT(!bt_value_array_append_element(array_obj, bool_obj));
-       BT_ASSERT(!bt_value_array_append_element(array_obj, integer_obj));
-       BT_ASSERT(!bt_value_array_append_element(array_obj, real_obj));
-       BT_ASSERT(!bt_value_array_append_element(array_obj, bt_value_null));
-       BT_ASSERT(!bt_value_map_insert_entry(map_obj, "array", array_obj));
-       BT_ASSERT(!bt_value_map_insert_entry(map_obj, "string", string_obj));
+       status = bt_private_value_array_append_element(array_obj,
+               bt_value_borrow_from_private(bool_obj));
+       BT_ASSERT(status == BT_VALUE_STATUS_OK);
+       status = bt_private_value_array_append_element(array_obj,
+               bt_value_borrow_from_private(integer_obj));
+       BT_ASSERT(status == BT_VALUE_STATUS_OK);
+       status = bt_private_value_array_append_element(array_obj,
+               bt_value_borrow_from_private(real_obj));
+       BT_ASSERT(status == BT_VALUE_STATUS_OK);
+       status = bt_private_value_array_append_element(array_obj,
+               bt_value_null);
+       BT_ASSERT(status == BT_VALUE_STATUS_OK);
+       status = bt_private_value_map_insert_entry(map_obj, "array",
+               bt_value_borrow_from_private(array_obj));
+       BT_ASSERT(status == BT_VALUE_STATUS_OK);
+       status = bt_private_value_map_insert_entry(map_obj, "string",
+               bt_value_borrow_from_private(string_obj));
+       BT_ASSERT(status == BT_VALUE_STATUS_OK);
 
-       map_copy_obj = bt_value_copy(map_obj);
+       map_copy_obj = bt_value_copy(bt_value_borrow_from_private(map_obj));
        ok(map_copy_obj,
                "bt_value_copy() succeeds");
 
        ok(map_obj != map_copy_obj,
                "bt_value_copy() returns a different pointer (map)");
-       string_copy_obj = bt_value_map_borrow_entry_value(map_copy_obj, "string");
+       string_copy_obj = bt_private_value_map_borrow_entry_value(map_copy_obj,
+               "string");
        ok(string_copy_obj != string_obj,
                "bt_value_copy() returns a different pointer (string)");
-       array_copy_obj = bt_value_map_borrow_entry_value(map_copy_obj, "array");
+       array_copy_obj = bt_private_value_map_borrow_entry_value(map_copy_obj,
+               "array");
        ok(array_copy_obj != array_obj,
                "bt_value_copy() returns a different pointer (array)");
-       bool_copy_obj = bt_value_array_borrow_element_by_index(array_copy_obj, 0);
+       bool_copy_obj = bt_private_value_array_borrow_element_by_index(
+               array_copy_obj, 0);
        ok(bool_copy_obj != bool_obj,
                "bt_value_copy() returns a different pointer (bt_bool)");
-       integer_copy_obj = bt_value_array_borrow_element_by_index(array_copy_obj, 1);
+       integer_copy_obj = bt_private_value_array_borrow_element_by_index(
+               array_copy_obj, 1);
        ok(integer_copy_obj != integer_obj,
                "bt_value_copy() returns a different pointer (integer)");
-       real_copy_obj = bt_value_array_borrow_element_by_index(array_copy_obj, 2);
+       real_copy_obj = bt_private_value_array_borrow_element_by_index(
+               array_copy_obj, 2);
        ok(real_copy_obj != real_obj,
                "bt_value_copy() returns a different pointer (real)");
-       null_copy_obj = bt_value_array_borrow_element_by_index(array_copy_obj, 3);
-       ok(null_copy_obj == bt_value_null,
+       null_copy_obj = bt_private_value_array_borrow_element_by_index(
+               array_copy_obj, 3);
+       ok(bt_value_borrow_from_private(null_copy_obj) == bt_value_null,
                "bt_value_copy() returns the same pointer (null)");
 
-       ok(bt_value_compare(map_obj, map_copy_obj),
+       ok(bt_value_compare(bt_value_borrow_from_private(map_obj),
+               bt_value_borrow_from_private(map_copy_obj)),
                "source and destination value objects have the same content");
 
        BT_OBJECT_PUT_REF_AND_RESET(map_copy_obj);
@@ -874,42 +996,57 @@ bt_bool compare_map_elements(struct bt_value *map_a, struct bt_value *map_b,
 static
 void test_extend(void)
 {
-       struct bt_value *base_map = bt_value_map_create();
-       struct bt_value *extension_map = bt_value_map_create();
-       struct bt_value *extended_map = NULL;
-       struct bt_value *array = bt_value_array_create();
+       struct bt_private_value *base_map = bt_private_value_map_create();
+       struct bt_private_value *extension_map = bt_private_value_map_create();
+       struct bt_private_value *extended_map = NULL;
+       struct bt_private_value *array = bt_private_value_array_create();
        enum bt_value_status status;
 
        BT_ASSERT(base_map);
        BT_ASSERT(extension_map);
        BT_ASSERT(array);
-       status = bt_value_map_insert_bool_entry(base_map, "file", BT_TRUE);
+       status = bt_private_value_map_insert_bool_entry(base_map, "file",
+               BT_TRUE);
        BT_ASSERT(status == BT_VALUE_STATUS_OK);
-       status = bt_value_map_insert_bool_entry(base_map, "edit", BT_FALSE);
+       status = bt_private_value_map_insert_bool_entry(base_map, "edit",
+               BT_FALSE);
        BT_ASSERT(status == BT_VALUE_STATUS_OK);
-       status = bt_value_map_insert_integer_entry(base_map, "selection", 17);
+       status = bt_private_value_map_insert_integer_entry(base_map,
+               "selection", 17);
        BT_ASSERT(status == BT_VALUE_STATUS_OK);
-       status = bt_value_map_insert_integer_entry(base_map, "find", -34);
+       status = bt_private_value_map_insert_integer_entry(base_map, "find",
+               -34);
        BT_ASSERT(status == BT_VALUE_STATUS_OK);
-       status = bt_value_map_insert_bool_entry(extension_map, "edit", BT_TRUE);
+       status = bt_private_value_map_insert_bool_entry(extension_map, "edit",
+               BT_TRUE);
        BT_ASSERT(status == BT_VALUE_STATUS_OK);
-       status = bt_value_map_insert_integer_entry(extension_map, "find", 101);
+       status = bt_private_value_map_insert_integer_entry(extension_map,
+               "find", 101);
        BT_ASSERT(status == BT_VALUE_STATUS_OK);
-       status = bt_value_map_insert_real_entry(extension_map, "project", -404);
+       status = bt_private_value_map_insert_real_entry(extension_map,
+               "project", -404);
        BT_ASSERT(status == BT_VALUE_STATUS_OK);
-       extended_map = bt_value_map_extend(base_map, extension_map);
+       extended_map = bt_value_map_extend(
+               bt_value_borrow_from_private(base_map),
+               bt_value_borrow_from_private(extension_map));
        ok(extended_map, "bt_value_map_extend() succeeds");
-       ok(bt_value_map_get_size(extended_map) == 5,
+       ok(bt_value_map_get_size(
+               bt_value_borrow_from_private(extended_map)) == 5,
                "bt_value_map_extend() returns a map object with the correct size");
-       ok(compare_map_elements(base_map, extended_map, "file"),
+       ok(compare_map_elements(bt_value_borrow_from_private(base_map),
+               bt_value_borrow_from_private(extended_map), "file"),
                "bt_value_map_extend() picks the appropriate element (file)");
-       ok(compare_map_elements(extension_map, extended_map, "edit"),
+       ok(compare_map_elements(bt_value_borrow_from_private(extension_map),
+               bt_value_borrow_from_private(extended_map), "edit"),
                "bt_value_map_extend() picks the appropriate element (edit)");
-       ok(compare_map_elements(base_map, extended_map, "selection"),
+       ok(compare_map_elements(bt_value_borrow_from_private(base_map),
+               bt_value_borrow_from_private(extended_map), "selection"),
                "bt_value_map_extend() picks the appropriate element (selection)");
-       ok(compare_map_elements(extension_map, extended_map, "find"),
+       ok(compare_map_elements(bt_value_borrow_from_private(extension_map),
+               bt_value_borrow_from_private(extended_map), "find"),
                "bt_value_map_extend() picks the appropriate element (find)");
-       ok(compare_map_elements(extension_map, extended_map, "project"),
+       ok(compare_map_elements(bt_value_borrow_from_private(extension_map),
+               bt_value_borrow_from_private(extended_map), "project"),
                "bt_value_map_extend() picks the appropriate element (project)");
 
        BT_OBJECT_PUT_REF_AND_RESET(array);
This page took 0.034533 seconds and 4 git commands to generate.