svn commit: r1920630 - in /apr/apr-util/branches/1.7.x: ./ test/abts.c test/abts.h

[email protected]
Newsgroups gmane.comp.apache.apr.cvs
Message-ID <[email protected]>
Author: ivan
Date: Sat Sep 14 14:58:49 2024
New Revision: 1920630

URL: http://svn.apache.org/viewvc?rev=1920630&view=rev
Log:
Merge r1902191, r1902192 from apr/trunk:
  * test/abts: More numeric types to compare/assert.
  * test/abts: Follow up to r1902191: Fix IMPL_abts_T_nequal.

Modified:
    apr/apr-util/branches/1.7.x/   (props changed)
    apr/apr-util/branches/1.7.x/test/abts.c
    apr/apr-util/branches/1.7.x/test/abts.h

Propchange: apr/apr-util/branches/1.7.x/
------------------------------------------------------------------------------
  Merged /apr/apr/trunk:r1902191-1902192

Modified: apr/apr-util/branches/1.7.x/test/abts.c
URL: http://svn.apache.org/viewvc/apr/apr-util/branches/1.7.x/test/abts.c?rev=1920630&r1=1920629&r2=1920630&view=diff
==============================================================================
--- apr/apr-util/branches/1.7.x/test/abts.c (original)
+++ apr/apr-util/branches/1.7.x/test/abts.c Sat Sep 14 14:58:49 2024
@@ -267,34 +267,52 @@ void abts_log_message(const char *fmt, .
     }
 }
 
-void abts_int_equal(abts_case *tc, const int expected, const int actual, int lineno)
-{
-    update_status();
-    if (tc->failed) return;
-
-    if (expected == actual) return;
-
-    tc->failed = TRUE;
-    if (verbose) {
-        fprintf(stderr, "Line %d: expected <%d>, but saw <%d>\n", lineno, expected, actual);
-        fflush(stderr);
-    }
+#define IMPL_abts_T_equal(T, NAME, FMT, CAST) \
+void abts_##NAME##_equal(abts_case *tc, const T expected, const T actual, int lineno) \
+{ \
+    update_status(); \
+    if (tc->failed) return; \
+    \
+    if (expected == actual) return; \
+    \
+    tc->failed = TRUE; \
+    if (verbose) { \
+        fprintf(stderr, "Line %d: expected <%" FMT ">, but saw <%" FMT ">\n", \
+                lineno, CAST expected, CAST actual); \
+        fflush(stderr); \
+    } \
 }
-
-void abts_int_nequal(abts_case *tc, const int expected, const int actual, int lineno)
-{
-    update_status();
-    if (tc->failed) return;
-
-    if (expected != actual) return;
-
-    tc->failed = TRUE;
-    if (verbose) {
-        fprintf(stderr, "Line %d: expected something other than <%d>, but saw <%d>\n",
-                lineno, expected, actual);
-        fflush(stderr);
-    }
+IMPL_abts_T_equal(int,                int,    "d",   (int))
+IMPL_abts_T_equal(unsigned int,       uint,   "u",   (unsigned int))
+IMPL_abts_T_equal(long,               long,   "ld",  (long))
+IMPL_abts_T_equal(unsigned long,      ulong,  "lu",  (unsigned long))
+IMPL_abts_T_equal(long long,          llong,  "lld", (long long))
+IMPL_abts_T_equal(unsigned long long, ullong, "llu", (unsigned long long))
+IMPL_abts_T_equal(size_t,             size,   "lu",  (unsigned long))
+
+#define IMPL_abts_T_nequal(T, NAME, FMT, CAST) \
+void abts_##NAME##_nequal(abts_case *tc, const T expected, const T actual, int lineno) \
+{ \
+    update_status(); \
+    if (tc->failed) return; \
+    \
+    if (expected != actual) return; \
+    \
+    tc->failed = TRUE; \
+    if (verbose) { \
+        fprintf(stderr, "Line %d: expected something other than <%" FMT ">, " \
+                "but saw <%" FMT ">\n", \
+                lineno, CAST expected, CAST actual); \
+        fflush(stderr); \
+    } \
 }
+IMPL_abts_T_nequal(int,                int,    "d",   (int))
+IMPL_abts_T_nequal(unsigned int,       uint,   "u",   (unsigned int))
+IMPL_abts_T_nequal(long,               long,   "ld",  (long))
+IMPL_abts_T_nequal(unsigned long,      ulong,  "lu",  (unsigned long))
+IMPL_abts_T_nequal(long long,          llong,  "lld", (long long))
+IMPL_abts_T_nequal(unsigned long long, ullong, "llu", (unsigned long long))
+IMPL_abts_T_nequal(size_t,             size,   "lu",  (unsigned long))
 
 void abts_str_equal(abts_case *tc, const char *expected, const char *actual, int lineno)
 {

Modified: apr/apr-util/branches/1.7.x/test/abts.h
URL: http://svn.apache.org/viewvc/apr/apr-util/branches/1.7.x/test/abts.h?rev=1920630&r1=1920629&r2=1920630&view=diff
==============================================================================
--- apr/apr-util/branches/1.7.x/test/abts.h (original)
+++ apr/apr-util/branches/1.7.x/test/abts.h Sat Sep 14 14:58:49 2024
@@ -73,6 +73,28 @@ void abts_log_message(const char *fmt, .
 
 void abts_int_equal(abts_case *tc, const int expected, const int actual, int lineno);
 void abts_int_nequal(abts_case *tc, const int expected, const int actual, int lineno);
+void abts_uint_equal(abts_case *tc, const unsigned int expected,
+                     const unsigned int actual, int lineno);
+void abts_uint_nequal(abts_case *tc, const unsigned int expected,
+                      const unsigned int actual, int lineno);
+void abts_long_equal(abts_case *tc, const long expected,
+                     const long actual, int lineno);
+void abts_long_nequal(abts_case *tc, const long expected,
+                      const long actual, int lineno);
+void abts_ulong_equal(abts_case *tc, const unsigned long expected,
+                      const unsigned long actual, int lineno);
+void abts_ulong_nequal(abts_case *tc, const unsigned long expected,
+                       const unsigned long actual, int lineno);
+void abts_llong_equal(abts_case *tc, const long long expected,
+                      const long long actual, int lineno);
+void abts_llong_nequal(abts_case *tc, const long long expected,
+                       const long long actual, int lineno);
+void abts_ullong_equal(abts_case *tc, const unsigned long long expected,
+                       const unsigned long long actual, int lineno);
+void abts_ullong_nequal(abts_case *tc, const unsigned long long expected,
+                        const unsigned long long actual, int lineno);
+void abts_size_equal(abts_case *tc, size_t expected, size_t actual, int lineno);
+void abts_size_nequal(abts_case *tc, size_t expected, size_t actual, int lineno);
 void abts_str_equal(abts_case *tc, const char *expected, const char *actual, int lineno);
 void abts_str_nequal(abts_case *tc, const char *expected, const char *actual,
                        size_t n, int lineno);
@@ -87,6 +109,18 @@ void abts_assert(abts_case *tc, const ch
 /* Convenience macros. Ryan hates these! */
 #define ABTS_INT_EQUAL(a, b, c)     abts_int_equal(a, b, c, __LINE__)
 #define ABTS_INT_NEQUAL(a, b, c)    abts_int_nequal(a, b, c, __LINE__)
+#define ABTS_UINT_EQUAL(a, b, c)    abts_uint_equal(a, b, c, __LINE__)
+#define ABTS_UINT_NEQUAL(a, b, c)   abts_uint_nequal(a, b, c, __LINE__)
+#define ABTS_LONG_EQUAL(a, b, c)    abts_long_equal(a, b, c, __LINE__)
+#define ABTS_LONG_NEQUAL(a, b, c)   abts_long_nequal(a, b, c, __LINE__)
+#define ABTS_ULONG_EQUAL(a, b, c)   abts_ulong_equal(a, b, c, __LINE__)
+#define ABTS_ULONG_NEQUAL(a, b, c)  abts_ulong_nequal(a, b, c, __LINE__)
+#define ABTS_LLONG_EQUAL(a, b, c)   abts_llong_equal(a, b, c, __LINE__)
+#define ABTS_LLONG_NEQUAL(a, b, c)  abts_llong_nequal(a, b, c, __LINE__)
+#define ABTS_ULLONG_EQUAL(a, b, c)  abts_ullong_equal(a, b, c, __LINE__)
+#define ABTS_ULLONG_NEQUAL(a, b, c) abts_ullong_nequal(a, b, c, __LINE__)
+#define ABTS_SIZE_EQUAL(a, b, c)    abts_size_equal(a, b, c, __LINE__)
+#define ABTS_SIZE_NEQUAL(a, b, c)   abts_size_nequal(a, b, c, __LINE__)
 #define ABTS_STR_EQUAL(a, b, c)     abts_str_equal(a, b, c, __LINE__)
 #define ABTS_STR_NEQUAL(a, b, c, d) abts_str_nequal(a, b, c, d, __LINE__)
 #define ABTS_PTR_NOTNULL(a, b)      abts_ptr_notnull(a, b, __LINE__)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.