// 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:

   /**
    * Tests successful date string parse
    *
    * @param spec
    *        date string
    * @param expectedYear
    *        expected result year
    * @param expectedMonth
    *        expected result month
    * @param expectedDay
    *        expected result day
    */
    METHOD PRIVATE VOID handleTestSuccess(
       INPUT spec AS CHARACTER,
       INPUT expectedYear AS INTEGER,
       INPUT expectedMonth AS INTEGER,
       INPUT expectedDay AS INTEGER):
       
       DEFINE VARIABLE result AS DATE NO-UNDO.
       
       result = ?.
       result = DATE(spec).
       Assert:Equals(expectedYear, YEAR(result)).
       Assert:Equals(expectedMonth, MONTH(result)).
       Assert:Equals(expectedDay, DAY(result)).
         
   END METHOD.

   /**
    * Tests successful date string parse to an unknown date value
    *
    * @param spec
    *        date string
    */
    METHOD PRIVATE VOID handleTestUnknown(
       INPUT spec AS CHARACTER):
       DEFINE VARIABLE result AS DATE NO-UNDO.
       
       result = DATE(spec).
       Assert:IsTrue(result = ?).
       
   END METHOD.

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

       DEFINE VARIABLE result AS DATE NO-UNDO.
       
       result = DATE(spec) NO-ERROR.

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

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

    @Test.
    METHOD PUBLIC VOID testNow():
        handleTestFailure("now", 12003).
        handleTestFailure("NOW", 12003).
        handleTestFailure("   now", 12003).
        handleTestFailure("   now   ", 12003).
    END METHOD.
    
    @Test.
    METHOD PUBLIC VOID testUnknownValues():
        SESSION:DATE-FORMAT = "ydm".

        handleTestUnknown("-").
        handleTestUnknown("--").
        handleTestUnknown("---").
        handleTestUnknown("----").
    END METHOD.

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

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

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

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

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

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

    END METHOD.

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

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

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

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

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

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

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

    END METHOD.

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


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

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

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

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

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

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

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

    END METHOD.

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

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

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

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

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

    END METHOD.

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

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

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

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

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


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

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

    END METHOD.

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

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

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

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

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

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

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

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

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

    END METHOD.

END CLASS.