[PATCH 6/8] tests: Introduce virTestCompareToULL()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This will be used later on in the test suite.
---
 tests/testutils.c | 27 +++++++++++++++++++++++++++
 tests/testutils.h |  2 ++
 2 files changed, 29 insertions(+)

diff --git a/tests/testutils.c b/tests/testutils.c
index 13eff9e..f3feb6d 100644
--- a/tests/testutils.c
+++ b/tests/testutils.c
@@ -722,6 +722,33 @@ virTestCompareToFile(const char *strcontent,
 }
 
 /*
+ * @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
  */
diff --git a/tests/testutils.h b/tests/testutils.h
index c7c641c..c16fe6c 100644
--- a/tests/testutils.h
+++ b/tests/testutils.h
@@ -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);
-- 
2.7.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux