// Test date parse in DATE(CHARACTER)
ROUTINE-LEVEL ON ERROR UNDO, THROW.

USING OpenEdge.Core.Assert FROM PROPATH.

CLASS unittests.gui.fillin.date.parse.TestParse:
   DEFINE VARIABLE testDate AS DATE NO-UNDO.
   DEFINE FRAME myFrame testDate.

   /**
    * Tests successful date string parse for current SESSION:DATE-FORMAT
    *
    * @param spec
    *        date string
    * @param expectedYear
    *        expected result year
    * @param expectedMonth
    *        expected result month
    * @param expectedDay
    *        expected result day
    */
    METHOD PRIVATE VOID testParseSuccess(
       INPUT spec AS CHARACTER,
       INPUT expectedYear AS INTEGER,
       INPUT expectedMonth AS INTEGER,
       INPUT expectedDay AS INTEGER):
       DO WITH FRAME myFrame:
         testDate = DATE(spec).

         Assert:Equals(expectedYear, YEAR(testDate)).
         Assert:Equals(expectedMonth, MONTH(testDate)).
         Assert:Equals(expectedDay, DAY(testDate)).
      END.
   END METHOD.

   /**
    * Tests successful date string parse to an unknown date value
    *
    * @param spec
    *        date string
    */
    METHOD PRIVATE VOID testParseUnknown(
       INPUT spec AS CHARACTER):
       DO WITH FRAME myFrame:
         testDate = DATE(spec).

         Assert:IsTrue(testDate:INPUT-VALUE = ?).
      END.
   END METHOD.

   /**
    * Tests date string parse failure to an unknown date value
    *
    * @param spec
    *        date string
    * @param errorNo
    *        expected error number
    */
    METHOD PRIVATE VOID testParseFailure(
       INPUT spec AS CHARACTER,
       INPUT errorNo AS INTEGER):

       DO WITH FRAME myFrame:
         testDate = DATE(spec) NO-ERROR.

         Assert:IsTrue(ERROR-STATUS:ERROR).
         Assert:Equals(errorNo, ERROR-STATUS:GET-NUMBER(1)).
       END.
   END METHOD.

    @Test.
    METHOD PUBLIC VOID testToday():
        testParseSuccess("today", YEAR(TODAY), MONTH(TODAY), DAY(TODAY)).
        testParseSuccess("ToDay", YEAR(TODAY), MONTH(TODAY), DAY(TODAY)).
        testParseSuccess("   today", YEAR(TODAY), MONTH(TODAY), DAY(TODAY)).
        testParseSuccess("   today ", YEAR(TODAY), MONTH(TODAY), DAY(TODAY)).
        testParseSuccess("   today ", YEAR(TODAY), MONTH(TODAY), DAY(TODAY)).
    END METHOD.

    @Test.
    METHOD PUBLIC VOID testUnknownValues():
        SESSION:DATE-FORMAT = "ydm".

        testParseUnknown("-").
        testParseUnknown("--").
        testParseUnknown("---").
        testParseUnknown("----").
    END METHOD.

    @Test.
    METHOD PUBLIC VOID testMdyFailures():
        SESSION:DATE-FORMAT = "mdy".


        testParseFailure("00100901 ", 80).
        testParseFailure("00100901", 80).
        testParseFailure("0010090198765", 80).
        testParseFailure("00100901 d", 80).
        testParseFailure("00100901d", 80).
        testParseFailure("0010095", 80).
        testParseFailure("001009     ", 80).
        testParseFailure("001009   ", 80).
        testParseFailure("001009  ", 80).
        testParseFailure("001009 ", 80).
        testParseFailure("001009", 80).
        testParseFailure("001009a", 80).
        testParseFailure("   00102", 80).
        testParseFailure("  001203to", 80).
        testParseFailure("1111----", 80).
        testParseFailure("11--213---", 81).
        testParseFailure("---1131", 80).
        testParseFailure("--113---", 80).
        testParseFailure("--1--1", 80).
        testParseFailure("11", 85).
        testParseFailure("1--2--3", 81).
        testParseFailure("12", 85).
        testParseFailure("1311", 80).
        testParseFailure("1-3--2---2-", 85).
        testParseFailure("--133----", 85).
        testParseFailure("-1--3--", 80).
        testParseFailure("-1-3---", 80).
        testParseFailure("13---", 80).
        testParseFailure("1--3", 81).
        testParseFailure("-----1-3", 85).
        testParseFailure("13", 85).
        testParseFailure("--1", 80).
        testParseFailure("-1", 85).
        testParseFailure("-1-", 85).
        testParseFailure("1", 85).
        testParseFailure("1-", 85).
        testParseFailure("-2--11", 80).
        testParseFailure("-2-1-1", 80).
        testParseFailure("213--33", 80).
        testParseFailure("213", 80).
        testParseFailure("-21-", 85).
        testParseFailure("21", 85).
        testParseFailure("-2-2", 80).
        testParseFailure("2--2", 81).
        testParseFailure("2--2-", 81).
        testParseFailure("22", 85).
        testParseFailure("2--3221-", 81).
        testParseFailure("--23", 80).
        testParseFailure("2----3", 81).
        testParseFailure("2--3", 81).
        testParseFailure("-23-", 85).
        testParseFailure("23", 85).
        testParseFailure("23-", 85).
        testParseFailure("2506151ss", 80).
        testParseFailure("25341210", 80).
        testParseFailure("2534121 s", 80).
        testParseFailure("2534121s", 80).
        testParseFailure("2534121ss", 80).
        testParseFailure("--2", 80).
        testParseFailure("--2-", 80).
        testParseFailure("-2---", 80).
        testParseFailure("-2----", 80).
        testParseFailure("2--", 81).
        testParseFailure("----2--", 85).
        testParseFailure("-2", 85).
        testParseFailure("-2-", 85).
        testParseFailure("2", 85).
        testParseFailure("2-", 85).
        testParseFailure("31-11-3", 80).
        testParseFailure("3--131-", 81).
        testParseFailure("3--13", 81).
        testParseFailure("31-", 85).
        testParseFailure("3-2-1-1-", 85).
        testParseFailure("---32", 80).
        testParseFailure("-32", 85).
        testParseFailure("-32-", 85).
        testParseFailure("3---3-13--31", 85).
        testParseFailure("-3332", 85).
        testParseFailure("3333", 80).
        testParseFailure("33", 85).
        testParseFailure("33-", 85).
        testParseFailure("-----3-", 80).
        testParseFailure("---3", 80).
        testParseFailure("---3-", 80).
        testParseFailure("--3", 80).
        testParseFailure("-3----", 80).
        testParseFailure("3--", 81).
        testParseFailure("-3", 85).
        testParseFailure("-3-", 85).
        testParseFailure("3", 85).
        testParseFailure("3-", 85).
    END METHOD.

    @Test.
    METHOD PUBLIC VOID testMdySuccesses():
        SESSION:DATE-FORMAT = "mdy".

        testParseSuccess("1-1-", 2025, 1, 1).
        testParseSuccess("3-2", 2025, 3, 2).
        testParseSuccess("3-1", 2025, 3, 1).
        testParseSuccess("2-3", 2025, 2, 3).
        testParseSuccess("12-2", 2025, 12, 2).
        testParseSuccess("2-23-", 2025, 2, 23).
        testParseSuccess("1-1---", 2000, 1, 1).
        testParseSuccess("1-23", 2025, 1, 23).

        // separatorless
        testParseSuccess("  010203today", 2003, 1, 2).
        testParseSuccess("  010203toda", 2003, 1, 2).
        testParseSuccess("  010203tod", 2003, 1, 2).
        testParseSuccess("  010203to", 2003, 1, 2).
        testParseSuccess(" 051", 2025, 5, 1).
        testParseSuccess(" 05102", 2002, 5, 10).

        testParseSuccess("051009 s", 2009, 5, 10).

    END METHOD.

    @Test.
    METHOD PUBLIC VOID testDmyFailures():
        SESSION:DATE-FORMAT = "dmy".

        testParseFailure("00100901 ", 81).
        testParseFailure("00100901", 81).
        testParseFailure("0010090198765", 81).
        testParseFailure("00100901 d", 81).
        testParseFailure("00100901d", 81).
        testParseFailure("0010095", 81).
        testParseFailure("001009     ", 81).
        testParseFailure("001009   ", 81).
        testParseFailure("001009  ", 81).
        testParseFailure("001009 ", 81).
        testParseFailure("001009", 81).
        testParseFailure("001009a", 81).
        testParseFailure("   00102", 81).
        testParseFailure("  001203to", 81).
        testParseFailure("1111----", 80).
        testParseFailure("11--213---", 80).
        testParseFailure("---1131", 80).
        testParseFailure("--113---", 80).
        testParseFailure("--1--1", 81).
        testParseFailure("11", 85).
        testParseFailure("1--2--3", 80).
        testParseFailure("1-23", 80).
        testParseFailure("12", 85).
        testParseFailure("1-3--2---2-", 85).
        testParseFailure("--133----", 85).
        testParseFailure("-1--3--", 80).
        testParseFailure("1--3", 80).
        testParseFailure("13---", 80).
        testParseFailure("-1-3---", 81).
        testParseFailure("-----1-3", 85).
        testParseFailure("13", 85).
        testParseFailure("--1", 81).
        testParseFailure("-1", 85).
        testParseFailure("-1-", 85).
        testParseFailure("1", 85).
        testParseFailure("1-", 85).
        testParseFailure("-2--11", 80).
        testParseFailure("-2-1-1", 81).
        testParseFailure("213--33", 80).
        testParseFailure("-21-", 85).
        testParseFailure("21", 85).
        testParseFailure("2-23-", 80).
        testParseFailure("2--2", 80).
        testParseFailure("2--2-", 80).
        testParseFailure("-2-2", 81).
        testParseFailure("22", 85).
        testParseFailure("2--3221-", 80).
        testParseFailure("--23", 80).
        testParseFailure("2----3", 80).
        testParseFailure("2--3", 80).
        testParseFailure("-23-", 85).
        testParseFailure("23", 85).
        testParseFailure("23-", 85).
        testParseFailure("25341210", 80).
        testParseFailure("2534121 s", 80).
        testParseFailure("2534121s", 80).
        testParseFailure("2534121ss", 80).
        testParseFailure("-2---", 80).
        testParseFailure("-2----", 80).
        testParseFailure("2--", 80).
        testParseFailure("--2", 81).
        testParseFailure("--2-", 81).
        testParseFailure("----2--", 85).
        testParseFailure("-2", 85).
        testParseFailure("-2-", 85).
        testParseFailure("2", 85).
        testParseFailure("2-", 85).
        testParseFailure("31-11-3", 81).
        testParseFailure("3--131-", 80).
        testParseFailure("3--13", 80).
        testParseFailure("31-", 85).
        testParseFailure("3-2-1-1-", 85).
        testParseFailure("---32", 80).
        testParseFailure("-32", 85).
        testParseFailure("-32-", 85).
        testParseFailure("3---3-13--31", 85).
        testParseFailure("-3332", 85).
        testParseFailure("3333", 80).
        testParseFailure("33", 85).
        testParseFailure("33-", 85).
        testParseFailure("-----3-", 80).
        testParseFailure("---3", 80).
        testParseFailure("---3-", 80).
        testParseFailure("-3----", 80).
        testParseFailure("3--", 80).
        testParseFailure("--3", 81).
        testParseFailure("-3", 85).
        testParseFailure("-3-", 85).
        testParseFailure("3", 85).
        testParseFailure("3-", 85).
    END METHOD.

    @Test.
    METHOD PUBLIC VOID testDmySuccesses():
        SESSION:DATE-FORMAT = "dmy".

        testParseSuccess("1-1-", 2025, 1, 1).
        testParseSuccess("3-2", 2025, 2, 3).
        testParseSuccess("3-1", 2025, 1, 3).
        testParseSuccess("2-3", 2025, 3, 2).
        testParseSuccess("12-2", 2025, 2, 12).
        testParseSuccess("1-1---", 2000, 1, 1).
        testParseSuccess("213", 2025, 3, 21).
        testParseSuccess("1311", 2025, 11, 13).

        testParseSuccess("  010203today", 2003, 2, 1).
        testParseSuccess("  010203toda", 2003, 2, 1).
        testParseSuccess("  010203tod", 2003, 2, 1).
        testParseSuccess("  010203to", 2003, 2, 1).
        testParseSuccess(" 051", 2025, 1, 5).
        testParseSuccess(" 05102", 2002, 10, 5).

        testParseSuccess("2506151ss", 2015, 6, 25).

        testParseSuccess("051009 s", 2009, 10, 5).

    END METHOD.

    @Test.
    METHOD PUBLIC VOID testYmdFailures():
        SESSION:DATE-FORMAT = "ymd".


        testParseFailure("00100", 81). // bad day
        testParseFailure("0010", 80). // bad month
        testParseFailure("001", 80). // bad month
        testParseFailure("001a", 80). // bad month
        testParseFailure("00", 85). // only 1 spec
        testParseFailure("  010203to", 80).
        testParseFailure("01", 85). // only 1 spec
        testParseFailure("051009 s", 80).
        testParseFailure("1111----", 80).
        testParseFailure("11--213---", 80).
        testParseFailure("---1131", 80).
        testParseFailure("--113---", 80).
        testParseFailure("--1--1", 81).
        testParseFailure("1-1---", 81).
        testParseFailure("11", 85).
        testParseFailure("1--2--3", 80).
        testParseFailure("12", 85).
        testParseFailure("1311", 80).
        testParseFailure("1-3--2---2-", 85).
        testParseFailure("--133----", 85).
        testParseFailure("-1--3--", 80).
        testParseFailure("13---", 80).
        testParseFailure("-1-3---", 81).
        testParseFailure("1--3", 81).
        testParseFailure("-----1-3", 85).
        testParseFailure("13", 85).
        testParseFailure("--1", 80).
        testParseFailure("-1", 85).
        testParseFailure("-1-", 85).
        testParseFailure("1", 85).
        testParseFailure("1-", 85).
        testParseFailure("-2--11", 80).
        testParseFailure("213--33", 80).
        testParseFailure("213", 80).
        testParseFailure("-21-", 85).
        testParseFailure("21", 85).
        testParseFailure("-2-2", 80).
        testParseFailure("2--2", 81).
        testParseFailure("2--2-", 81).
        testParseFailure("22", 85).
        testParseFailure("2--3221-", 81).
        testParseFailure("--23", 80).
        testParseFailure("2----3", 80).
        testParseFailure("2--3", 81).
        testParseFailure("-23-", 85).
        testParseFailure("23", 85).
        testParseFailure("23-", 85).
        testParseFailure("2534121 s", 80).
        testParseFailure("2534121ss", 80).
        testParseFailure("--2", 80).
        testParseFailure("--2-", 80).
        testParseFailure("-2---", 80).
        testParseFailure("-2----", 80).
        testParseFailure("2--", 81).
        testParseFailure("----2--", 85).
        testParseFailure("-2", 85).
        testParseFailure("-2-", 85).
        testParseFailure("2", 85).
        testParseFailure("2-", 85).
        testParseFailure("3--131-", 81).
        testParseFailure("3--13", 81).
        testParseFailure("31-", 85).
        testParseFailure("3-2-1-1-", 85).
        testParseFailure("---32", 80).
        testParseFailure("-32", 85).
        testParseFailure("-32-", 85).
        testParseFailure("3---3-13--31", 85).
        testParseFailure("-3332", 85).
        testParseFailure("3333", 80).
        testParseFailure("33", 85).
        testParseFailure("33-", 85).
        testParseFailure("-----3-", 80).
        testParseFailure("---3", 80).
        testParseFailure("---3-", 80).
        testParseFailure("--3", 80).
        testParseFailure("-3----", 80).
        testParseFailure("3--", 81).
        testParseFailure("-3", 85).
        testParseFailure("-3-", 85).
        testParseFailure("3", 85).
        testParseFailure("3-", 85).
        testParseFailure(" ?", 85).
        testParseFailure("a today", 85).
        testParseFailure("today a", 85).
    END METHOD.

    @Test.
    METHOD PUBLIC VOID testYmdSuccesses():
        SESSION:DATE-FORMAT = "ymd".

        testParseSuccess("1-1-", 2025, 1, 1).
        testParseSuccess("3-2", 2025, 3, 2).
        testParseSuccess("3-1", 2025, 3, 1).
        testParseSuccess("2-3", 2025, 2, 3).
        testParseSuccess("31-11-3", 2031, 11, 3).
        testParseSuccess("12-2", 2025, 12, 2).
        testParseSuccess("2-23-", 2025, 2, 23).
        testParseSuccess("1-23", 2025, 1, 23).

        // separatorless
        testParseSuccess("  010203today", 2001, 2, 3).
        testParseSuccess("  010203toda", 2001, 2, 3).
        testParseSuccess("  010203tod", 2001, 2, 3).
        testParseSuccess("  001203to", 2025, 12, 3).
        testParseSuccess(" 051", 2025, 5, 1).
        testParseSuccess("   00102", 2000, 10, 2).
        testParseSuccess(" 05102", 2005, 10, 2).

        testParseSuccess("001009", 2000, 10, 9).
        testParseSuccess("001009 ", 2000, 10, 9).
        testParseSuccess("001009  ", 2025, 10, 9).
        testParseSuccess("001009   ", 2000, 10, 9).
        testParseSuccess("001009     ", 2000, 10, 9).

        testParseSuccess("2506151ss", 2025, 6, 15).
        testParseSuccess("25341210", 2534, 12, 10).
        testParseSuccess("2534121s", 2534, 12, 1).

        testParseSuccess("001009a", 2000, 10, 9).
        testParseSuccess("0010095", 2000, 10, 9).
        testParseSuccess("00100901", 10, 9, 1).
        testParseSuccess("00100901 ", 2000, 10, 9).
        testParseSuccess("00100901d", 2000, 10, 9).
        testParseSuccess("0010090198765", 2000, 10, 9).
        testParseSuccess("00100901 d", 2000, 10, 9).

    END METHOD.

    @Test.
    METHOD PUBLIC VOID testMydFailures():
        SESSION:DATE-FORMAT = "myd".

        testParseFailure("00100901 ", 80).
        testParseFailure("00100901", 80).
        testParseFailure("0010090198765", 80).
        testParseFailure("00100901 d", 80).
        testParseFailure("00100901d", 80).
        testParseFailure("0010095", 80).
        testParseFailure("001009     ", 80).
        testParseFailure("001009   ", 80).
        testParseFailure("001009  ", 80).
        testParseFailure("001009 ", 80).
        testParseFailure("001009", 80).
        testParseFailure("001009a", 80).
        testParseFailure("   00102", 80).
        testParseFailure("  001203to", 80).
        testParseFailure("  010203to", 81).
        testParseFailure("051009 s", 81).
        testParseFailure("1111----", 80).
        testParseFailure("11--213---", 81).
        testParseFailure("---1131", 80).
        testParseFailure("--113---", 80).
        testParseFailure("--1--1", 80).
        testParseFailure("1-1---", 81).
        testParseFailure("11", 85).
        testParseFailure("1--2--3", 81).
        testParseFailure("12", 85).
        testParseFailure("1311", 80).
        testParseFailure("1-3--2---2-", 85).
        testParseFailure("--133----", 85).
        testParseFailure("-1--3--", 80).
        testParseFailure("-1-3---", 80).
        testParseFailure("13---", 80).
        testParseFailure("1--3", 81).
        testParseFailure("-----1-3", 85).
        testParseFailure("13", 85).
        testParseFailure("--1", 80).
        testParseFailure("-1", 85).
        testParseFailure("-1-", 85).
        testParseFailure("1", 85).
        testParseFailure("1-", 85).
        testParseFailure("-2--11", 80).
        testParseFailure("-2-1-1", 80).
        testParseFailure("213--33", 80).
        testParseFailure("213", 80).
        testParseFailure("-21-", 85).
        testParseFailure("21", 85).
        testParseFailure("-2-2", 80).
        testParseFailure("2--2", 81).
        testParseFailure("2--2-", 81).
        testParseFailure("22", 85).
        testParseFailure("2--3221-", 81).
        testParseFailure("--23", 80).
        testParseFailure("2----3", 81).
        testParseFailure("2--3", 81).
        testParseFailure("-23-", 85).
        testParseFailure("23", 85).
        testParseFailure("23-", 85).
        testParseFailure("2506151ss", 80).
        testParseFailure("25341210", 80).
        testParseFailure("2534121 s", 80).
        testParseFailure("2534121s", 80).
        testParseFailure("2534121ss", 80).
        testParseFailure("--2", 80).
        testParseFailure("--2-", 80).
        testParseFailure("-2---", 80).
        testParseFailure("-2----", 80).
        testParseFailure("2--", 81).
        testParseFailure("----2--", 85).
        testParseFailure("-2", 85).
        testParseFailure("-2-", 85).
        testParseFailure("2", 85).
        testParseFailure("2-", 85).
        testParseFailure("31-11-3", 80).
        testParseFailure("3--131-", 81).
        testParseFailure("3--13", 81).
        testParseFailure("31-", 85).
        testParseFailure("3-2-1-1-", 85).
        testParseFailure("---32", 80).
        testParseFailure("-32", 85).
        testParseFailure("-32-", 85).
        testParseFailure("3---3-13--31", 85).
        testParseFailure("-3332", 85).
        testParseFailure("3333", 80).
        testParseFailure("33", 85).
        testParseFailure("33-", 85).
        testParseFailure("-----3-", 80).
        testParseFailure("---3", 80).
        testParseFailure("---3-", 80).
        testParseFailure("--3", 80).
        testParseFailure("-3----", 80).
        testParseFailure("3--", 81).
        testParseFailure("-3", 85).
        testParseFailure("-3-", 85).
        testParseFailure("3", 85).
        testParseFailure("3-", 85).
    END METHOD.

    @Test.
    METHOD PUBLIC VOID testMydSuccesses():
        SESSION:DATE-FORMAT = "myd".

        testParseSuccess("1-1-", 2025, 1, 1).
        testParseSuccess("3-2", 2025, 3, 2).
        testParseSuccess("3-1", 2025, 3, 1).
        testParseSuccess("2-3", 2025, 2, 3).
        testParseSuccess("12-2", 2025, 12, 2).
        testParseSuccess("2-23-", 2025, 2, 23).
        testParseSuccess("1-23", 2025, 1, 23).

        testParseSuccess("  010203today", 2002, 1, 3).
        testParseSuccess("  010203toda", 2002, 1, 3).
        testParseSuccess("  010203tod", 2002, 1, 3).
        testParseSuccess(" 051", 2025, 5, 1).
        testParseSuccess(" 05102", 2010, 5, 2).

    END METHOD.

    @Test.
    METHOD PUBLIC VOID testDymFailures():
        SESSION:DATE-FORMAT = "dym".

        testParseFailure("00100901 ", 81).
        testParseFailure("00100901", 81).
        testParseFailure("0010090198765", 81).
        testParseFailure("00100901 d", 81).
        testParseFailure("00100901d", 81).
        testParseFailure("0010095", 81).
        testParseFailure("001009  ", 80).
        testParseFailure("001009     ", 81).
        testParseFailure("001009   ", 81).
        testParseFailure("001009 ", 81).
        testParseFailure("001009", 81).
        testParseFailure("001009a", 81).
        testParseFailure("   00102", 81).
        testParseFailure("  001203to", 80).
        testParseFailure("  010203to", 80).
        testParseFailure("051009 s", 80).
        testParseFailure("1111----", 80).
        testParseFailure("11--213---", 80).
        testParseFailure("---1131", 80).
        testParseFailure("--113---", 80).
        testParseFailure("--1--1", 80).
        testParseFailure("1-1---", 80).
        testParseFailure("11", 85).
        testParseFailure("1--2--3", 80).
        testParseFailure("1-23", 80).
        testParseFailure("12", 85).
        testParseFailure("1-3--2---2-", 85).
        testParseFailure("--133----", 85).
        testParseFailure("-1--3--", 80).
        testParseFailure("-1-3---", 80).
        testParseFailure("1--3", 80).
        testParseFailure("13---", 80).
        testParseFailure("-----1-3", 85).
        testParseFailure("13", 85).
        testParseFailure("--1", 81).
        testParseFailure("-1", 85).
        testParseFailure("-1-", 85).
        testParseFailure("1", 85).
        testParseFailure("1-", 85).
        testParseFailure("-2--11", 80).
        testParseFailure("-2-1-1", 81).
        testParseFailure("213--33", 80).
        testParseFailure("-21-", 85).
        testParseFailure("21", 85).
        testParseFailure("2-23-", 80).
        testParseFailure("2--2", 80).
        testParseFailure("2--2-", 80).
        testParseFailure("-2-2", 81).
        testParseFailure("22", 85).
        testParseFailure("2--3221-", 80).
        testParseFailure("--23", 80).
        testParseFailure("2----3", 80).
        testParseFailure("2--3", 80).
        testParseFailure("-23-", 85).
        testParseFailure("23", 85).
        testParseFailure("23-", 85).
        testParseFailure("2506151ss", 80).
        testParseFailure("-2---", 80).
        testParseFailure("-2----", 80).
        testParseFailure("2--", 80).
        testParseFailure("--2", 81).
        testParseFailure("--2-", 81).
        testParseFailure("----2--", 85).
        testParseFailure("-2", 85).
        testParseFailure("-2-", 85).
        testParseFailure("2", 85).
        testParseFailure("2-", 85).
        testParseFailure("3--131-", 80).
        testParseFailure("3--13", 80).
        testParseFailure("31-", 85).
        testParseFailure("3-2-1-1-", 85).
        testParseFailure("---32", 80).
        testParseFailure("-32", 85).
        testParseFailure("-32-", 85).
        testParseFailure("3---3-13--31", 85).
        testParseFailure("-3332", 85).
        testParseFailure("3333", 80).
        testParseFailure("33", 85).
        testParseFailure("33-", 85).
        testParseFailure("-----3-", 80).
        testParseFailure("---3", 80).
        testParseFailure("---3-", 80).
        testParseFailure("-3----", 80).
        testParseFailure("3--", 80).
        testParseFailure("--3", 81).
        testParseFailure("-3", 85).
        testParseFailure("-3-", 85).
        testParseFailure("3", 85).
        testParseFailure("3-", 85).
    END METHOD.

    @Test.
    METHOD PUBLIC VOID testDymSuccesses():
        SESSION:DATE-FORMAT = "dym".

        testParseSuccess("1-1-", 2025, 1, 1).
        testParseSuccess("3-2", 2025, 2, 3).
        testParseSuccess("3-1", 2025, 1, 3).
        testParseSuccess("2-3", 2025, 3, 2).
        testParseSuccess("31-11-3", 2011, 3, 31).
        testParseSuccess("12-2", 2025, 2, 12).
        testParseSuccess("213", 2025, 3, 21).
        testParseSuccess("1311", 2025, 11, 13).

        testParseSuccess("  010203today", 2002, 3, 1).
        testParseSuccess("  010203toda", 2002, 3, 1).
        testParseSuccess("  010203tod", 2002, 3, 1).
        testParseSuccess(" 051", 2025, 1, 5).
        testParseSuccess(" 05102", 2010, 2, 5).


        testParseSuccess("25341210", 3412, 10, 25).
        testParseSuccess("2534121s", 3412, 1, 25).

        testParseSuccess("2534121 s", 2034, 12, 25).
        testParseSuccess("2534121ss", 2034, 12, 25).

    END METHOD.

    @Test.
    METHOD PUBLIC VOID testYdmFailures():
        SESSION:DATE-FORMAT = "ydm".

        testParseFailure("00905", 81).
        testParseFailure("1111----", 80).
        testParseFailure("11--213---", 80).
        testParseFailure("---1131", 80).
        testParseFailure("--113---", 80).
        testParseFailure("--1--1", 80).
        testParseFailure("1-1---", 80).
        testParseFailure("11", 85).
        testParseFailure("1--2--3", 80).
        testParseFailure("1-23", 80).
        testParseFailure("12", 85).
        testParseFailure("1-3--2---2-", 85).
        testParseFailure("--133----", 85).
        testParseFailure("-1--3--", 80).
        testParseFailure("-1-3---", 80).
        testParseFailure("1--3", 80).
        testParseFailure("13---", 80).
        testParseFailure("-----1-3", 85).
        testParseFailure("13", 85).
        testParseFailure("--1", 81).
        testParseFailure("-1", 85).
        testParseFailure("-1-", 85).
        testParseFailure("1", 85).
        testParseFailure("1-", 85).
        testParseFailure("20241231", 80).
        testParseFailure("20691231", 80).
        testParseFailure("21005", 81).
        testParseFailure("-2--11", 80).
        testParseFailure("213--33", 80).
        testParseFailure("-21-", 85).
        testParseFailure("21", 85).
        testParseFailure("2-23-", 80).
        testParseFailure("2--2", 80).
        testParseFailure("2--2-", 80).
        testParseFailure("-2-2", 81).
        testParseFailure("22", 85).
        testParseFailure(" 230904to", 81).             // Space and suffix. 8 chars: default 2309 04, day invalid
        testParseFailure("2--3221-", 80).
        testParseFailure("--23", 80).
        testParseFailure("2----3", 80).
        testParseFailure("2--3", 80).
        testParseFailure("-23-", 85).
        testParseFailure("23", 85).
        testParseFailure("23-", 85).
        testParseFailure("241231", 80).
        testParseFailure("-2---", 80).
        testParseFailure("-2----", 80).
        testParseFailure("2--", 80).
        testParseFailure("--2", 81).
        testParseFailure("--2-", 81).
        testParseFailure("----2--", 85).
        testParseFailure("-2", 85).
        testParseFailure("-2-", 85).
        testParseFailure("2", 85).
        testParseFailure("2-", 85).
        testParseFailure("30904", 81).                 // 30 90 4 invalid day (90)
        testParseFailure(" 30904s ", 81).              // 30 90 4 invalid day (90)
        testParseFailure("3--131-", 80).
        testParseFailure("3--13", 80).
        testParseFailure("31-", 85).
        testParseFailure("3-2-1-1-", 85).
        testParseFailure("---32", 80).
        testParseFailure("-32", 85).
        testParseFailure("-32-", 85).
        testParseFailure("3---3-13--31", 85).
        testParseFailure("-3332", 85).
        testParseFailure("3333", 80).
        testParseFailure("33", 85).
        testParseFailure("33-", 85).
        testParseFailure("-----3-", 80).
        testParseFailure("---3", 80).
        testParseFailure("---3-", 80).
        testParseFailure("-3----", 80).
        testParseFailure("3--", 80).
        testParseFailure("--3", 81).
        testParseFailure("-3", 85).
        testParseFailure("-3-", 85).
        testParseFailure("3", 85).
        testParseFailure("3-", 85).
    END METHOD.

    @Test.
    METHOD PUBLIC VOID testYdmSuccesses():
        SESSION:DATE-FORMAT = "ydm".

        testParseSuccess("1-1-", 2025, 1, 1).
        testParseSuccess("3-2", 2025, 2, 3).
        testParseSuccess("3-1", 2025, 1, 3).
        testParseSuccess("2-3", 2025, 3, 2).
        testParseSuccess("31-11-3", 2031, 3, 11).
        testParseSuccess("12-2", 2025, 2, 12).
        testParseSuccess("213", 2025, 3, 21).
        testParseSuccess("1311", 2025, 11, 13).

        // Standard 8-digit inputs (4-digit year, [4,2,2] split)
        testParseSuccess("20230904", 2023, 4, 9).      // Clean: year=2023, day=9, month=4
        testParseSuccess(" 20230904 ", 2020, 9, 23).   // Spaces around. 20 23 09
        testParseSuccess("20230904xyz", 2020, 9, 23).  // Trailing letters
        testParseSuccess("20020301", 2002, 1, 3).      // Original Test 1 fix
        testParseSuccess("20021005", 2002, 5, 10).     // Original Test 2 fix
        testParseSuccess("20100905", 2010, 5, 9).      // Original Test 3 fix

        // Standard 6-digit inputs (2-digit year, [2,2,2] split)
        testParseSuccess("230904", 2023, 4, 9).        // Clean: year=2023, day=9, month=4
        testParseSuccess("230904 ", 2023, 4, 9).       // Trailing space
        testParseSuccess("020301", 2002, 1, 3).        // Original Test 1 fix
        testParseSuccess("021005", 2002, 5, 10).       // Original Test 2 fix
        testParseSuccess("100905", 2010, 5, 9).        // Original Test 3 fix
        testParseSuccess("990101", 1999, 1, 1).        // Older year
        testParseSuccess("690101", 1969, 1, 1).        // 69 (-> 1969) 1 1

        // 5-digit inputs (1-digit year, [1,2,2] split, if supported)
        testParseSuccess("20301", 2020, 1, 30).

        // Edge cases (8-digit)
        testParseSuccess("20240101", 2024, 1, 1).      // First day of year
        testParseSuccess("2029022902", 2020, 2, 29).     // Leap year
        testParseSuccess(" 20240229xy ", 2020, 2, 24). // Leap year with noise
        testParseSuccess("20000101", 2000, 1, 1).      // Year 2000

        // Edge cases (6-digit)
        testParseSuccess("240101", 2024, 1, 1).        // First day

    END METHOD.

END CLASS.