Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package aws-c-common for openSUSE:Factory 
checked in at 2024-03-18 16:46:30
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/aws-c-common (Old)
 and      /work/SRC/openSUSE:Factory/.aws-c-common.new.1905 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "aws-c-common"

Mon Mar 18 16:46:30 2024 rev:3 rq:1158911 version:0.9.14

Changes:
--------
--- /work/SRC/openSUSE:Factory/aws-c-common/aws-c-common.changes        
2024-02-21 17:59:09.977269560 +0100
+++ /work/SRC/openSUSE:Factory/.aws-c-common.new.1905/aws-c-common.changes      
2024-03-18 16:46:47.579903120 +0100
@@ -1,0 +2,6 @@
+Mon Mar 18 08:27:37 UTC 2024 - Dirk Müller <dmuel...@suse.com>
+
+- update to 0.9.14:
+  * Accept all RFC3339-compliant timestamps
+
+-------------------------------------------------------------------

Old:
----
  v0.9.13.tar.gz

New:
----
  v0.9.14.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ aws-c-common.spec ++++++
--- /var/tmp/diff_new_pack.DFGynF/_old  2024-03-18 16:46:48.703944560 +0100
+++ /var/tmp/diff_new_pack.DFGynF/_new  2024-03-18 16:46:48.707944708 +0100
@@ -19,7 +19,7 @@
 %define library_version 1.0.0
 %define library_soversion 1
 Name:           aws-c-common
-Version:        0.9.13
+Version:        0.9.14
 Release:        0
 Summary:        Core C99 package for AWS SDK for C
 License:        Apache-2.0

++++++ v0.9.13.tar.gz -> v0.9.14.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/aws-c-common-0.9.13/include/aws/common/date_time.h 
new/aws-c-common-0.9.14/include/aws/common/date_time.h
--- old/aws-c-common-0.9.13/include/aws/common/date_time.h      2024-02-13 
19:09:29.000000000 +0100
+++ new/aws-c-common-0.9.14/include/aws/common/date_time.h      2024-03-05 
18:16:27.000000000 +0100
@@ -80,11 +80,14 @@
  * Initializes dt to be the time represented by date_str in format 'fmt'. 
Returns AWS_OP_SUCCESS if the
  * string was successfully parsed, returns  AWS_OP_ERR if parsing failed.
  *
+ * The parser is lenient regarding AWS_DATE_FORMAT_ISO_8601 vs 
AWS_DATE_FORMAT_ISO_8601_BASIC.
+ * Regardless of which you pass in, both "2002-10-02T08:05:09Z" and 
"20021002T080509Z" would be accepted.
+ *
  * Notes for AWS_DATE_FORMAT_RFC822:
  * If no time zone information is provided, it is assumed to be local time 
(please don't do this).
  *
- * If the time zone is something other than something indicating Universal 
Time (e.g. Z, UT, UTC, or GMT) or an offset
- * from UTC (e.g. +0100, -0700), parsing will fail.
+ * Only time zones indicating Universal Time (e.g. Z, UT, UTC, or GMT),
+ * or offsets from UTC (e.g. +0100, -0700), are accepted.
  *
  * Really, it's just better if you always use Universal Time.
  */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/aws-c-common-0.9.13/source/date_time.c 
new/aws-c-common-0.9.14/source/date_time.c
--- old/aws-c-common-0.9.13/source/date_time.c  2024-02-13 19:09:29.000000000 
+0100
+++ new/aws-c-common-0.9.14/source/date_time.c  2024-03-05 18:16:27.000000000 
+0100
@@ -131,7 +131,7 @@
     size_t len = strlen(str);
 
     if (len > 0) {
-        if (str[0] == 'Z') {
+        if (tolower((uint8_t)str[0]) == 'z') {
             return true;
         }
 
@@ -207,232 +207,7 @@
     FINISHED,
 };
 
-static int s_parse_iso_8601_basic(const struct aws_byte_cursor 
*date_str_cursor, struct tm *parsed_time) {
-    size_t index = 0;
-    size_t state_start_index = 0;
-    enum parser_state state = ON_YEAR;
-    bool error = false;
-
-    AWS_ZERO_STRUCT(*parsed_time);
-
-    while (state < FINISHED && !error && index < date_str_cursor->len) {
-        char c = (char)date_str_cursor->ptr[index];
-        size_t sub_index = index - state_start_index;
-        switch (state) {
-            case ON_YEAR:
-                if (aws_isdigit(c)) {
-                    parsed_time->tm_year = parsed_time->tm_year * 10 + (c - 
'0');
-                    if (sub_index == 3) {
-                        state = ON_MONTH;
-                        state_start_index = index + 1;
-                        parsed_time->tm_year -= 1900;
-                    }
-                } else {
-                    error = true;
-                }
-                break;
-
-            case ON_MONTH:
-                if (aws_isdigit(c)) {
-                    parsed_time->tm_mon = parsed_time->tm_mon * 10 + (c - '0');
-                    if (sub_index == 1) {
-                        state = ON_MONTH_DAY;
-                        state_start_index = index + 1;
-                        parsed_time->tm_mon -= 1;
-                    }
-                } else {
-                    error = true;
-                }
-                break;
-
-            case ON_MONTH_DAY:
-                if (c == 'T' && sub_index == 2) {
-                    state = ON_HOUR;
-                    state_start_index = index + 1;
-                } else if (aws_isdigit(c)) {
-                    parsed_time->tm_mday = parsed_time->tm_mday * 10 + (c - 
'0');
-                } else {
-                    error = true;
-                }
-                break;
-
-            case ON_HOUR:
-                if (aws_isdigit(c)) {
-                    parsed_time->tm_hour = parsed_time->tm_hour * 10 + (c - 
'0');
-                    if (sub_index == 1) {
-                        state = ON_MINUTE;
-                        state_start_index = index + 1;
-                    }
-                } else {
-                    error = true;
-                }
-                break;
-
-            case ON_MINUTE:
-                if (aws_isdigit(c)) {
-                    parsed_time->tm_min = parsed_time->tm_min * 10 + (c - '0');
-                    if (sub_index == 1) {
-                        state = ON_SECOND;
-                        state_start_index = index + 1;
-                    }
-                } else {
-                    error = true;
-                }
-                break;
-
-            case ON_SECOND:
-                if (aws_isdigit(c)) {
-                    parsed_time->tm_sec = parsed_time->tm_sec * 10 + (c - '0');
-                    if (sub_index == 1) {
-                        state = ON_TZ;
-                        state_start_index = index + 1;
-                    }
-                } else {
-                    error = true;
-                }
-                break;
-
-            case ON_TZ:
-                if (c == 'Z' && (sub_index == 0 || sub_index == 3)) {
-                    state = FINISHED;
-                } else if (!aws_isdigit(c) || sub_index > 3) {
-                    error = true;
-                }
-                break;
-
-            default:
-                error = true;
-                break;
-        }
-
-        index++;
-    }
-
-    /* ISO8601 supports date only with no time portion. state ==ON_MONTH_DAY 
catches this case. */
-    return (state == FINISHED || state == ON_MONTH_DAY) && !error ? 
AWS_OP_SUCCESS : AWS_OP_ERR;
-}
-
-static int s_parse_iso_8601(const struct aws_byte_cursor *date_str_cursor, 
struct tm *parsed_time) {
-    size_t index = 0;
-    size_t state_start_index = 0;
-    enum parser_state state = ON_YEAR;
-    bool error = false;
-    bool advance = true;
-
-    AWS_ZERO_STRUCT(*parsed_time);
-
-    while (state < FINISHED && !error && index < date_str_cursor->len) {
-        char c = (char)date_str_cursor->ptr[index];
-        switch (state) {
-            case ON_YEAR:
-                if (c == '-' && index - state_start_index == 4) {
-                    state = ON_MONTH;
-                    state_start_index = index + 1;
-                    parsed_time->tm_year -= 1900;
-                } else if (aws_isdigit(c)) {
-                    parsed_time->tm_year = parsed_time->tm_year * 10 + (c - 
'0');
-                } else {
-                    error = true;
-                }
-                break;
-            case ON_MONTH:
-                if (c == '-' && index - state_start_index == 2) {
-                    state = ON_MONTH_DAY;
-                    state_start_index = index + 1;
-                    parsed_time->tm_mon -= 1;
-                } else if (aws_isdigit(c)) {
-                    parsed_time->tm_mon = parsed_time->tm_mon * 10 + (c - '0');
-                } else {
-                    error = true;
-                }
-
-                break;
-            case ON_MONTH_DAY:
-                if (c == 'T' && index - state_start_index == 2) {
-                    state = ON_HOUR;
-                    state_start_index = index + 1;
-                } else if (aws_isdigit(c)) {
-                    parsed_time->tm_mday = parsed_time->tm_mday * 10 + (c - 
'0');
-                } else {
-                    error = true;
-                }
-                break;
-            /* note: no time portion is spec compliant. */
-            case ON_HOUR:
-                /* time parts can be delimited by ':' or just concatenated 
together, but must always be 2 digits. */
-                if (index - state_start_index == 2) {
-                    state = ON_MINUTE;
-                    state_start_index = index + 1;
-                    if (aws_isdigit(c)) {
-                        state_start_index = index;
-                        advance = false;
-                    } else if (c != ':') {
-                        error = true;
-                    }
-                } else if (aws_isdigit(c)) {
-                    parsed_time->tm_hour = parsed_time->tm_hour * 10 + (c - 
'0');
-                } else {
-                    error = true;
-                }
-
-                break;
-            case ON_MINUTE:
-                /* time parts can be delimited by ':' or just concatenated 
together, but must always be 2 digits. */
-                if (index - state_start_index == 2) {
-                    state = ON_SECOND;
-                    state_start_index = index + 1;
-                    if (aws_isdigit(c)) {
-                        state_start_index = index;
-                        advance = false;
-                    } else if (c != ':') {
-                        error = true;
-                    }
-                } else if (aws_isdigit(c)) {
-                    parsed_time->tm_min = parsed_time->tm_min * 10 + (c - '0');
-                } else {
-                    error = true;
-                }
-
-                break;
-            case ON_SECOND:
-                if (c == 'Z' && index - state_start_index == 2) {
-                    state = FINISHED;
-                    state_start_index = index + 1;
-                } else if (c == '.' && index - state_start_index == 2) {
-                    state = ON_TZ;
-                    state_start_index = index + 1;
-                } else if (aws_isdigit(c)) {
-                    parsed_time->tm_sec = parsed_time->tm_sec * 10 + (c - '0');
-                } else {
-                    error = true;
-                }
-
-                break;
-            case ON_TZ:
-                if (c == 'Z') {
-                    state = FINISHED;
-                    state_start_index = index + 1;
-                } else if (!aws_isdigit(c)) {
-                    error = true;
-                }
-                break;
-            default:
-                error = true;
-                break;
-        }
-
-        if (advance) {
-            index++;
-        } else {
-            advance = true;
-        }
-    }
-
-    /* ISO8601 supports date only with no time portion. state ==ON_MONTH_DAY 
catches this case. */
-    return (state == FINISHED || state == ON_MONTH_DAY) && !error ? 
AWS_OP_SUCCESS : AWS_OP_ERR;
-}
-
-static int s_parse_rfc_822(
+static bool s_parse_rfc_822(
     const struct aws_byte_cursor *date_str_cursor,
     struct tm *parsed_time,
     struct aws_date_time *dt) {
@@ -564,7 +339,186 @@
         }
     }
 
-    return error || state != ON_TZ ? AWS_OP_ERR : AWS_OP_SUCCESS;
+    return error || state != ON_TZ ? false : true;
+}
+
+/* Returns true if the next N characters are digits, advancing the string and 
getting their numeric value */
+static bool s_read_n_digits(struct aws_byte_cursor *str, size_t n, int 
*out_val) {
+    int val = 0;
+    if (str->len < n) {
+        return false;
+    }
+
+    for (size_t i = 0; i < n; ++i) {
+        uint8_t c = str->ptr[i];
+        if (aws_isdigit(c)) {
+            val = val * 10 + (c - '0');
+        } else {
+            return false;
+        }
+    }
+
+    aws_byte_cursor_advance(str, n);
+    *out_val = val;
+    return true;
+}
+
+/* Returns true if there's 1 more character, advancing the string and getting 
the character's value. */
+static bool s_read_1_char(struct aws_byte_cursor *str, uint8_t *out_c) {
+    if (str->len == 0) {
+        return false;
+    }
+
+    *out_c = str->ptr[0];
+    aws_byte_cursor_advance(str, 1);
+    return true;
+}
+
+/* Returns true (and advances str) if next character is c */
+static bool s_advance_if_next_char_is(struct aws_byte_cursor *str, uint8_t c) {
+    if (str->len == 0 || str->ptr[0] != c) {
+        return false;
+    }
+
+    aws_byte_cursor_advance(str, 1);
+    return true;
+}
+
+/* If the (optional) fractional seconds (".123" or ",123") are next, str is 
advanced.
+ * Returns false if there was an error */
+static bool s_skip_optional_fractional_seconds(struct aws_byte_cursor *str) {
+    if (str->len == 0) {
+        return true;
+    }
+
+    uint8_t c = str->ptr[0];
+    if (c != '.' && c != ',') {
+        return true;
+    }
+
+    size_t num_digits = 0;
+    for (size_t i = 1; i < str->len; ++i) {
+        if (aws_isdigit(str->ptr[i])) {
+            ++num_digits;
+        } else {
+            break;
+        }
+    }
+
+    if (num_digits == 0) {
+        return false;
+    }
+
+    aws_byte_cursor_advance(str, 1 + num_digits);
+    return true;
+}
+
+/* Parses ISO 8601, both extended and basic format are accepted.
+ * Returns true if successful. */
+static bool s_parse_iso_8601(struct aws_byte_cursor str, struct tm 
*parsed_time, time_t *seconds_offset) {
+    AWS_ZERO_STRUCT(*parsed_time);
+    *seconds_offset = 0;
+    uint8_t c = 0;
+
+    /* read year */
+    if (!s_read_n_digits(&str, 4, &parsed_time->tm_year)) {
+        return false;
+    }
+    parsed_time->tm_year -= 1900;
+
+    /* be lenient, allow date with separator or not */
+    bool has_date_separator = s_advance_if_next_char_is(&str, '-');
+
+    /* read month */
+    if (!s_read_n_digits(&str, 2, &parsed_time->tm_mon)) {
+        return false;
+    }
+    parsed_time->tm_mon -= 1;
+
+    if (has_date_separator) {
+        if (!s_read_1_char(&str, &c) || c != '-') {
+            return false;
+        }
+    }
+
+    /* read month-day */
+    if (!s_read_n_digits(&str, 2, &parsed_time->tm_mday)) {
+        return false;
+    }
+
+    /* ISO8601 supports date only with no time portion */
+    if (str.len == 0) {
+        return true;
+    }
+
+    /* followed by T or space (allowed by rfc3339#section-5.6) */
+    if (!s_read_1_char(&str, &c) || (tolower(c) != 't' && c != ' ')) {
+        return false;
+    }
+
+    /* read hours */
+    if (!s_read_n_digits(&str, 2, &parsed_time->tm_hour)) {
+        return false;
+    }
+
+    /* be lenient, allow time with separator or not */
+    bool has_time_separator = s_advance_if_next_char_is(&str, ':');
+
+    /* read minutes */
+    if (!s_read_n_digits(&str, 2, &parsed_time->tm_min)) {
+        return false;
+    }
+
+    if (has_time_separator) {
+        if (!s_read_1_char(&str, &c) || c != ':') {
+            return false;
+        }
+    }
+
+    /* read seconds */
+    if (!s_read_n_digits(&str, 2, &parsed_time->tm_sec)) {
+        return false;
+    }
+
+    /* fractional seconds are optional (discard value since tm struct has no 
corresponding field) */
+    if (!s_skip_optional_fractional_seconds(&str)) {
+        return false;
+    }
+
+    /* read final Z, or (+/-) indicating there will be an offset */
+    if (!s_read_1_char(&str, &c)) {
+        return false;
+    }
+
+    if (tolower(c) == 'z') {
+        /* Success! */
+        return true;
+    }
+
+    if (c != '+' && c != '-') {
+        return false;
+    }
+
+    bool negative_offset = c == '-';
+
+    /* read hours offset */
+    int hours_offset = 0;
+    if (!s_read_n_digits(&str, 2, &hours_offset)) {
+        return false;
+    }
+
+    /* be lenient, allow offset with separator or not */
+    s_advance_if_next_char_is(&str, ':');
+
+    /* read minutes offset */
+    int minutes_offset = 0;
+    if (!s_read_n_digits(&str, 2, &minutes_offset)) {
+        return false;
+    }
+
+    /* Success! */
+    *seconds_offset = (time_t)(hours_offset * 3600 + minutes_offset * 60) * 
(negative_offset ? -1 : 1);
+    return true;
 }
 
 int aws_date_time_init_from_str_cursor(
@@ -579,22 +533,16 @@
     bool successfully_parsed = false;
 
     time_t seconds_offset = 0;
-    if (fmt == AWS_DATE_FORMAT_ISO_8601 || fmt == AWS_DATE_FORMAT_AUTO_DETECT) 
{
-        if (!s_parse_iso_8601(date_str_cursor, &parsed_time)) {
-            dt->utc_assumed = true;
-            successfully_parsed = true;
-        }
-    }
-
-    if (fmt == AWS_DATE_FORMAT_ISO_8601_BASIC || (fmt == 
AWS_DATE_FORMAT_AUTO_DETECT && !successfully_parsed)) {
-        if (!s_parse_iso_8601_basic(date_str_cursor, &parsed_time)) {
+    if (fmt == AWS_DATE_FORMAT_ISO_8601 || fmt == 
AWS_DATE_FORMAT_ISO_8601_BASIC ||
+        fmt == AWS_DATE_FORMAT_AUTO_DETECT) {
+        if (s_parse_iso_8601(*date_str_cursor, &parsed_time, &seconds_offset)) 
{
             dt->utc_assumed = true;
             successfully_parsed = true;
         }
     }
 
     if (fmt == AWS_DATE_FORMAT_RFC822 || (fmt == AWS_DATE_FORMAT_AUTO_DETECT 
&& !successfully_parsed)) {
-        if (!s_parse_rfc_822(date_str_cursor, &parsed_time, dt)) {
+        if (s_parse_rfc_822(date_str_cursor, &parsed_time, dt)) {
             successfully_parsed = true;
 
             if (dt->utc_assumed) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/aws-c-common-0.9.13/tests/CMakeLists.txt 
new/aws-c-common-0.9.14/tests/CMakeLists.txt
--- old/aws-c-common-0.9.13/tests/CMakeLists.txt        2024-02-13 
19:09:29.000000000 +0100
+++ new/aws-c-common-0.9.14/tests/CMakeLists.txt        2024-03-05 
18:16:27.000000000 +0100
@@ -360,13 +360,12 @@
 add_test_case(rfc822_invalid_format)
 add_test_case(rfc822_invalid_tz)
 add_test_case(rfc822_invalid_auto_format)
-add_test_case(iso8601_utc_parsing)
+add_test_case(iso8601_parsing)
 add_test_case(iso8601_basic_utc_parsing)
 add_test_case(iso8601_utc_parsing_auto_detect)
 add_test_case(iso8601_basic_utc_parsing_auto_detect)
 add_test_case(iso8601_date_only_parsing)
 add_test_case(iso8601_basic_date_only_parsing)
-add_test_case(iso8601_utc_no_colon_parsing)
 add_test_case(iso8601_utc_dos_prevented)
 add_test_case(iso8601_invalid_format)
 add_test_case(iso8601_invalid_auto_format)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/aws-c-common-0.9.13/tests/date_time_test.c 
new/aws-c-common-0.9.14/tests/date_time_test.c
--- old/aws-c-common-0.9.13/tests/date_time_test.c      2024-02-13 
19:09:29.000000000 +0100
+++ new/aws-c-common-0.9.14/tests/date_time_test.c      2024-03-05 
18:16:27.000000000 +0100
@@ -19,7 +19,7 @@
         "Wed, 02 Oct 2002 08:05:09 UTC",
     };
 
-    for (size_t i = 0; i < 4; ++i) {
+    for (size_t i = 0; i < AWS_ARRAY_SIZE(valid_utc_dates); ++i) {
         struct aws_date_time date_time;
         const char *date_str = valid_utc_dates[i];
         struct aws_byte_buf date_buf = aws_byte_buf_from_c_str(date_str);
@@ -284,52 +284,73 @@
 
 AWS_TEST_CASE(rfc822_invalid_auto_format, s_test_rfc822_invalid_auto_format_fn)
 
-static int s_test_iso8601_utc_parsing_fn(struct aws_allocator *allocator, void 
*ctx) {
+static int s_test_iso8601_parsing_fn(struct aws_allocator *allocator, void 
*ctx) {
     (void)allocator;
     (void)ctx;
 
-    struct aws_date_time date_time;
-    const char *date_str = "2002-10-02T08:05:09.000Z";
-    struct aws_byte_buf date_buf = aws_byte_buf_from_c_str(date_str);
+    /* array of {"date", "description"} */
+    const char *valid_dates[][2] = {
+        {"2002-10-02T08:05:09.000Z", "extended format"},
+        {"2002-10-02t08:05:09.000z", "lowercase T and Z"},
+        {"2002-10-02 08:05:09Z", "space instead of T"}, /*allowed per NOTE in 
RFC3339#section-5.6 */
+        {"2002-10-02T08:05:09+00:00", "offset instead of Z"},
+        {"2002-10-01T19:31:09-12:34", "western offset"},
+        {"2002-10-02T20:39:09+12:34", "eastern offset"},
+        {"2002-10-02T08:05:09.000+00:00", "fractional seconds and offset"},
+        {"20021002T080509.000Z", "basic format"},
+        {"20021002T203909+1234", "basic format with fractional seconds"},
+        {"2002-10-02T080509.000Z", "weird mix of extended date but basic 
time"},
+        {"20021002T08:05:09.000Z", "weird mix of basic date but extended 
time"},
+        {"2002-10-02T20:39:09+1234", "weird mix of extended date and time but 
basic fractional seconds"},
+    };
 
-    ASSERT_SUCCESS(aws_date_time_init_from_str(&date_time, &date_buf, 
AWS_DATE_FORMAT_ISO_8601));
-    ASSERT_INT_EQUALS(AWS_DATE_DAY_OF_WEEK_WEDNESDAY, 
aws_date_time_day_of_week(&date_time, false));
-    ASSERT_UINT_EQUALS(2, aws_date_time_month_day(&date_time, false));
-    ASSERT_UINT_EQUALS(AWS_DATE_MONTH_OCTOBER, aws_date_time_month(&date_time, 
false));
-    ASSERT_UINT_EQUALS(2002, aws_date_time_year(&date_time, false));
-    ASSERT_UINT_EQUALS(8, aws_date_time_hour(&date_time, false));
-    ASSERT_UINT_EQUALS(5, aws_date_time_minute(&date_time, false));
-    ASSERT_UINT_EQUALS(9, aws_date_time_second(&date_time, false));
+    for (size_t i = 0; i < AWS_ARRAY_SIZE(valid_dates); ++i) {
+        const char *date_str = valid_dates[i][0];
+        const char *description = valid_dates[i][1];
+        printf("checking date[%zu] \"%s\" (%s)\n", i, date_str, description);
 
-    uint8_t date_output[AWS_DATE_TIME_STR_MAX_LEN];
-    AWS_ZERO_ARRAY(date_output);
-    struct aws_byte_buf str_output = aws_byte_buf_from_array(date_output, 
sizeof(date_output));
-    str_output.len = 0;
-    ASSERT_SUCCESS(aws_date_time_to_utc_time_str(&date_time, 
AWS_DATE_FORMAT_ISO_8601, &str_output));
+        struct aws_date_time date_time;
+        struct aws_byte_buf date_buf = aws_byte_buf_from_c_str(date_str);
 
-    const char *expected_date_str = "2002-10-02T08:05:09Z";
-    struct aws_byte_buf expected_date_buf = 
aws_byte_buf_from_c_str(expected_date_str);
-    ASSERT_BIN_ARRAYS_EQUALS(expected_date_buf.buffer, expected_date_buf.len, 
str_output.buffer, str_output.len);
+        ASSERT_SUCCESS(aws_date_time_init_from_str(&date_time, &date_buf, 
AWS_DATE_FORMAT_ISO_8601));
+        ASSERT_INT_EQUALS(AWS_DATE_DAY_OF_WEEK_WEDNESDAY, 
aws_date_time_day_of_week(&date_time, false));
+        ASSERT_UINT_EQUALS(2, aws_date_time_month_day(&date_time, false));
+        ASSERT_UINT_EQUALS(AWS_DATE_MONTH_OCTOBER, 
aws_date_time_month(&date_time, false));
+        ASSERT_UINT_EQUALS(2002, aws_date_time_year(&date_time, false));
+        ASSERT_UINT_EQUALS(8, aws_date_time_hour(&date_time, false));
+        ASSERT_UINT_EQUALS(5, aws_date_time_minute(&date_time, false));
+        ASSERT_UINT_EQUALS(9, aws_date_time_second(&date_time, false));
 
-    AWS_ZERO_ARRAY(date_output);
-    str_output.len = 0;
-    ASSERT_SUCCESS(aws_date_time_to_utc_time_short_str(&date_time, 
AWS_DATE_FORMAT_ISO_8601, &str_output));
+        uint8_t date_output[AWS_DATE_TIME_STR_MAX_LEN];
+        AWS_ZERO_ARRAY(date_output);
+        struct aws_byte_buf str_output = aws_byte_buf_from_array(date_output, 
sizeof(date_output));
+        str_output.len = 0;
+        ASSERT_SUCCESS(aws_date_time_to_utc_time_str(&date_time, 
AWS_DATE_FORMAT_ISO_8601, &str_output));
 
-    const char *expected_short_str = "2002-10-02";
-    struct aws_byte_buf expected_short_buf = 
aws_byte_buf_from_c_str(expected_short_str);
+        const char *expected_date_str = "2002-10-02T08:05:09Z";
+        struct aws_byte_buf expected_date_buf = 
aws_byte_buf_from_c_str(expected_date_str);
+        ASSERT_BIN_ARRAYS_EQUALS(expected_date_buf.buffer, 
expected_date_buf.len, str_output.buffer, str_output.len);
 
-    ASSERT_BIN_ARRAYS_EQUALS(expected_short_buf.buffer, 
expected_short_buf.len, str_output.buffer, str_output.len);
+        AWS_ZERO_ARRAY(date_output);
+        str_output.len = 0;
+        ASSERT_SUCCESS(aws_date_time_to_utc_time_short_str(&date_time, 
AWS_DATE_FORMAT_ISO_8601, &str_output));
+
+        const char *expected_short_str = "2002-10-02";
+        struct aws_byte_buf expected_short_buf = 
aws_byte_buf_from_c_str(expected_short_str);
+
+        ASSERT_BIN_ARRAYS_EQUALS(expected_short_buf.buffer, 
expected_short_buf.len, str_output.buffer, str_output.len);
+    }
     return AWS_OP_SUCCESS;
 }
 
-AWS_TEST_CASE(iso8601_utc_parsing, s_test_iso8601_utc_parsing_fn)
+AWS_TEST_CASE(iso8601_parsing, s_test_iso8601_parsing_fn)
 
 static int s_test_iso8601_basic_utc_parsing_fn(struct aws_allocator 
*allocator, void *ctx) {
     (void)allocator;
     (void)ctx;
 
     struct aws_date_time date_time;
-    const char *date_str = "20021002T080509000Z";
+    const char *date_str = "20021002T080509.000Z";
     struct aws_byte_buf date_buf = aws_byte_buf_from_c_str(date_str);
 
     ASSERT_SUCCESS(aws_date_time_init_from_str(&date_time, &date_buf, 
AWS_DATE_FORMAT_ISO_8601_BASIC));
@@ -401,7 +422,7 @@
     (void)ctx;
 
     struct aws_date_time date_time;
-    const char *date_str = "20021002T080509000Z";
+    const char *date_str = "20021002T080509,000Z";
     struct aws_byte_buf date_buf = aws_byte_buf_from_c_str(date_str);
 
     ASSERT_SUCCESS(aws_date_time_init_from_str(&date_time, &date_buf, 
AWS_DATE_FORMAT_AUTO_DETECT));
@@ -428,38 +449,6 @@
 
 AWS_TEST_CASE(iso8601_basic_utc_parsing_auto_detect, 
s_test_iso8601_basic_utc_parsing_auto_detect_fn)
 
-static int s_test_iso8601_utc_no_colon_parsing_fn(struct aws_allocator 
*allocator, void *ctx) {
-    (void)allocator;
-    (void)ctx;
-
-    struct aws_date_time date_time;
-    const char *date_str = "2002-10-02T080509.000Z";
-    struct aws_byte_buf date_buf = aws_byte_buf_from_c_str(date_str);
-
-    ASSERT_SUCCESS(aws_date_time_init_from_str(&date_time, &date_buf, 
AWS_DATE_FORMAT_ISO_8601));
-    ASSERT_INT_EQUALS(AWS_DATE_DAY_OF_WEEK_WEDNESDAY, 
aws_date_time_day_of_week(&date_time, false));
-    ASSERT_UINT_EQUALS(2, aws_date_time_month_day(&date_time, false));
-    ASSERT_UINT_EQUALS(AWS_DATE_MONTH_OCTOBER, aws_date_time_month(&date_time, 
false));
-    ASSERT_UINT_EQUALS(2002, aws_date_time_year(&date_time, false));
-    ASSERT_UINT_EQUALS(8, aws_date_time_hour(&date_time, false));
-    ASSERT_UINT_EQUALS(5, aws_date_time_minute(&date_time, false));
-    ASSERT_UINT_EQUALS(9, aws_date_time_second(&date_time, false));
-
-    uint8_t date_output[AWS_DATE_TIME_STR_MAX_LEN];
-    AWS_ZERO_ARRAY(date_output);
-    struct aws_byte_buf str_output = aws_byte_buf_from_array(date_output, 
sizeof(date_output));
-    str_output.len = 0;
-    ASSERT_SUCCESS(aws_date_time_to_utc_time_str(&date_time, 
AWS_DATE_FORMAT_ISO_8601, &str_output));
-
-    const char *expected_date_str = "2002-10-02T08:05:09Z";
-    struct aws_byte_buf expected_date_buf = 
aws_byte_buf_from_c_str(expected_date_str);
-    ASSERT_BIN_ARRAYS_EQUALS(expected_date_buf.buffer, expected_date_buf.len, 
str_output.buffer, str_output.len);
-
-    return AWS_OP_SUCCESS;
-}
-
-AWS_TEST_CASE(iso8601_utc_no_colon_parsing, 
s_test_iso8601_utc_no_colon_parsing_fn)
-
 static int s_test_iso8601_date_only_parsing_fn(struct aws_allocator 
*allocator, void *ctx) {
     (void)allocator;
     (void)ctx;

Reply via email to