From d57e09c67c489501562b2bffb97975804febe82b Mon Sep 17 00:00:00 2001
From: Lubos Slovak <lubos.slovak@nic.cz>
Date: Mon, 22 Nov 2010 15:11:57 +0100
Subject: [PATCH] Fixed tests.

Wrong freeing of dname in test_dname_compare().
RDATA test count.
Comparing RDATA in test_rrset_rdata().
All tests count.
---
 src/tests/dnslib/dnslib_dname_tests.c | 1 -
 src/tests/dnslib/dnslib_rdata_tests.c | 2 +-
 src/tests/dnslib/dnslib_rrset_tests.c | 4 ++--
 src/tests/dnslib_tests.c              | 4 +++-
 4 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/tests/dnslib/dnslib_dname_tests.c b/src/tests/dnslib/dnslib_dname_tests.c
index be5986ba9..1bbfc519f 100644
--- a/src/tests/dnslib/dnslib_dname_tests.c
+++ b/src/tests/dnslib/dnslib_dname_tests.c
@@ -221,7 +221,6 @@ static int test_dname_compare()
   	}
 
     int errors = 0;
-    int ret = 0;
     /* abc < some */
     if (dnslib_dname_compare(dnames[0], dnames[1]) != -1) {
         diag("Dname comparison error");
diff --git a/src/tests/dnslib/dnslib_rdata_tests.c b/src/tests/dnslib/dnslib_rdata_tests.c
index d64dacbf6..2d4c46a90 100644
--- a/src/tests/dnslib/dnslib_rdata_tests.c
+++ b/src/tests/dnslib/dnslib_rdata_tests.c
@@ -677,7 +677,7 @@ static int test_rdata_to_wire()
 
 /*----------------------------------------------------------------------------*/
 
-static const int DNSLIB_RDATA_TEST_COUNT = 8;
+static const int DNSLIB_RDATA_TEST_COUNT = 7;
 
 /*! This helper routine should report number of
  *  scheduled tests for given parameters.
diff --git a/src/tests/dnslib/dnslib_rrset_tests.c b/src/tests/dnslib/dnslib_rrset_tests.c
index 242efcce9..8baa19530 100644
--- a/src/tests/dnslib/dnslib_rrset_tests.c
+++ b/src/tests/dnslib/dnslib_rrset_tests.c
@@ -230,7 +230,7 @@ static int test_rrset_create()
 		dnslib_dname_free(&owner);
 	}
 
-	diag("Total errors: %d", errors);
+	//diag("Total errors: %d", errors);
 
 	return (errors == 0);
 }
@@ -293,7 +293,7 @@ static int test_rrset_rdata()
     int i = 0;
     while (tmp->next!=rrset->rdata && !errors)
     {
-        if (atoi(test_strings[i]) != atoi(tmp->items[0].raw_data)) {
+		if (strcmp(test_strings[i], (char *)tmp->items[0].raw_data)) {
             diag("Adding RDATA error!, is %s should be %s",
                  tmp->items[0].raw_data, test_strings[i]);
             errors++;
diff --git a/src/tests/dnslib_tests.c b/src/tests/dnslib_tests.c
index 70427026b..edfbf7c79 100644
--- a/src/tests/dnslib_tests.c
+++ b/src/tests/dnslib_tests.c
@@ -25,7 +25,9 @@ unit_api dnslib_tests_api = {
 static int dnslib_tests_count(int argc, char *argv[])
 {
    return dnslib_dname_tests_count(argc, argv)
-		   + dnslib_rdata_tests_count(argc, argv);
+		   + dnslib_rdata_tests_count(argc, argv)
+		   + dnslib_rrset_tests_count(argc, argv)
+		   + dnslib_node_tests_count(argc, argv);
 }
 
 /*! Run all scheduled tests for given parameters.
-- 
GitLab