* test/testdate.c: Add regression test for r1807975.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1891197 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/test/testdate.c b/test/testdate.c
index b4e2edf..3d74b5c 100644
--- a/test/testdate.c
+++ b/test/testdate.c
@@ -191,12 +191,39 @@
}
}
+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;
}