You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by jo...@apache.org on 2021/07/02 11:07:16 UTC

svn commit: r1891197 - /apr/apr/trunk/test/testdate.c

Author: jorton
Date: Fri Jul  2 11:07:15 2021
New Revision: 1891197

URL: http://svn.apache.org/viewvc?rev=1891197&view=rev
Log:
* test/testdate.c: Add regression test for r1807975.

Modified:
    apr/apr/trunk/test/testdate.c

Modified: apr/apr/trunk/test/testdate.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/test/testdate.c?rev=1891197&r1=1891196&r2=1891197&view=diff
==============================================================================
--- apr/apr/trunk/test/testdate.c (original)
+++ apr/apr/trunk/test/testdate.c Fri Jul  2 11:07:15 2021
@@ -191,12 +191,39 @@ static void test_date_rfc(abts_case *tc,
     }
 }
 
+static void test_date_exp_get(abts_case *tc, void *data)
+{
+    apr_time_t t = {0};
+    apr_time_exp_t tm = {0};
+    unsigned n;
+    static const int ts[] = {
+        1, 2, 10, 100, 1000, 9000, 10000, 100000,
+        -1, -2, -10, -100, -1000, -9000, -10000, -100000,
+    };
+    
+    tm.tm_mday = 1;
+    tm.tm_year = 70;
+
+     for (n = 0; n < sizeof(ts)/sizeof(ts[0]); n++) {
+         apr_status_t rv;
+
+         tm.tm_mon = ts[n];
+         rv = apr_time_exp_get(&t, &tm);
+         if (ts[n] > 0 && ts[n] < 12)
+             APR_ASSERT_SUCCESS(tc, "apr_time_exp_get", rv);
+         else
+             ABTS_ASSERT(tc, "apr_time_exp_get should fail",
+                         rv == APR_EBADDATE);
+     }
+}
+
 abts_suite *testdate(abts_suite *suite)
 {
     suite = ADD_SUITE(suite);
 
     abts_run_test(suite, test_date_parse_http, NULL);
     abts_run_test(suite, test_date_rfc, NULL);
+    abts_run_test(suite, test_date_exp_get, NULL);
 
     return suite;
 }