]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
tests: Introduce virTestCompareToULL()
authorAndrea Bolognani <abologna@redhat.com>
Thu, 23 Mar 2017 13:29:43 +0000 (14:29 +0100)
committerAndrea Bolognani <abologna@redhat.com>
Tue, 28 Mar 2017 08:54:50 +0000 (10:54 +0200)
This will be used later on in the test suite.

tests/testutils.c
tests/testutils.h

index 13eff9e105d8adbca8bc9da5a8bce7c9175631f3..f3feb6d3f94e88651f1ca04714098d8ac68457f4 100644 (file)
@@ -721,6 +721,33 @@ virTestCompareToFile(const char *strcontent,
     return ret;
 }
 
+/*
+ * @param content: Input content
+ * @param src: Source to compare @content against
+ */
+int
+virTestCompareToULL(unsigned long long content,
+                    unsigned long long src)
+{
+    char *strcontent = NULL;
+    char *strsrc = NULL;
+    int ret = -1;
+
+    if (virAsprintf(&strcontent, "%llu", content) < 0)
+        goto cleanup;
+
+    if (virAsprintf(&strsrc, "%llu", src) < 0)
+        goto cleanup;
+
+    ret = virTestCompareToString(strcontent, strsrc);
+
+ cleanup:
+    VIR_FREE(strcontent);
+    VIR_FREE(strsrc);
+
+    return ret;
+}
+
 /*
  * @param strcontent: String input content
  * @param strsrc: String source to compare strcontent against
index c7c641c2606066b1b54086ddc5d7c087df5e7cab..c16fe6cc1eed368df194592b5c1253bade973188 100644 (file)
@@ -77,6 +77,8 @@ int virTestCompareToFile(const char *strcontent,
                          const char *filename);
 int virTestCompareToString(const char *strcontent,
                            const char *strsrc);
+int virTestCompareToULL(unsigned long long content,
+                        unsigned long long src);
 
 unsigned int virTestGetDebug(void);
 unsigned int virTestGetVerbose(void);