if offset < 0 || offset > 99 {
return self.overflow(f);
}
- write!(&mut output, "{offset:02}").unwrap();
+ write!(&mut output, "{:02}", date.year().abs() % 100).unwrap();
}
'q' => write!(&mut output, "{}", date.month0() / 3 + 1).unwrap(),
'w' => write!(
output.push('-');
}
time = time.abs();
- write!(&mut output, "{:1$.0}", (time / HOUR).floor(), n).unwrap();
+ write!(&mut output, "{:01$.0}", (time / HOUR).floor(), n).unwrap();
time %= HOUR;
}
'M' => {
} else if excess_width >= 5 {
let d = min(self.format.d(), excess_width as usize);
let w = d + 3;
- write!(&mut output, ":{:02$.*}", d, number, w).unwrap();
+ write!(&mut output, ":{:02$.*}", d, time, w).unwrap();
if self.settings.decimal == Decimal::Comma {
fix_decimal_point(&mut output);
}
}
+ break;
}
c if n == 1 => output.push(c as char),
_ => unreachable!(),
}
}
- write!(f, "{:>.*}", self.format.w(), &output)
+ write!(f, "{:>1$}", &output, self.format.w())
}
fn month(&self, f: &mut Formatter<'_>, number: f64) -> FmtResult {
use crate::{
dictionary::Value,
endian::Endian,
- format::{AbstractFormat, Format, Settings, Type, UncheckedFormat, CC},
+ format::{AbstractFormat, Epoch, Format, Settings, Type, UncheckedFormat, CC},
lex::{
scan::StringScanner,
segment::Syntax,
fn rb() {
test_binhex("rb.txt");
}
+
+ fn test_dates(format: Format, expect: &[&str]) {
+ let settings = Settings::default().with_epoch(Epoch(1930));
+ let parser = Format::new(Type::DateTime, 40, 0)
+ .unwrap()
+ .parser()
+ .with_settings(&settings);
+ static INPUTS: &[&str; 20] = &[
+ "10-6-1648 0:0:0",
+ "30-6-1680 4:50:38.12301",
+ "24-7-1716 12:31:35.23453",
+ "19-6-1768 12:47:53.34505",
+ "2-8-1819 1:26:0.45615",
+ "27-3-1839 20:58:11.56677",
+ "19-4-1903 7:36:5.18964",
+ "25-8-1929 15:43:49.83132",
+ "29-9-1941 4:25:9.01293",
+ "19-4-1943 6:49:27.52375",
+ "7-10-1943 2:57:52.01565",
+ "17-3-1992 16:45:44.86529",
+ "25-2-1996 21:30:57.82047",
+ "29-9-41 4:25:9.15395",
+ "19-4-43 6:49:27.10533",
+ "7-10-43 2:57:52.48229",
+ "17-3-92 16:45:44.65827",
+ "25-2-96 21:30:57.58219",
+ "10-11-2038 22:30:4.18347",
+ "18-7-2094 1:56:51.59319",
+ ];
+ assert_eq!(expect.len(), INPUTS.len());
+ for (input, expect) in INPUTS.iter().copied().zip(expect.iter().copied()) {
+ let value = parser.parse(input, UTF_8).unwrap();
+ let formatted = value
+ .display(format, UTF_8)
+ .with_settings(&settings)
+ .to_string();
+ assert_eq!(&formatted, expect);
+ }
+ }
+
+ #[test]
+ fn date9() {
+ test_dates(
+ Format::new(Type::Date, 9, 0).unwrap(),
+ &[
+ "*********",
+ "*********",
+ "*********",
+ "*********",
+ "*********",
+ "*********",
+ "*********",
+ "*********",
+ "29-SEP-41",
+ "19-APR-43",
+ "07-OCT-43",
+ "17-MAR-92",
+ "25-FEB-96",
+ "29-SEP-41",
+ "19-APR-43",
+ "07-OCT-43",
+ "17-MAR-92",
+ "25-FEB-96",
+ "*********",
+ "*********",
+ ],
+ );
+ }
+
+ #[test]
+ fn date11() {
+ test_dates(
+ Format::new(Type::Date, 11, 0).unwrap(),
+ &[
+ "10-JUN-1648",
+ "30-JUN-1680",
+ "24-JUL-1716",
+ "19-JUN-1768",
+ "02-AUG-1819",
+ "27-MAR-1839",
+ "19-APR-1903",
+ "25-AUG-1929",
+ "29-SEP-1941",
+ "19-APR-1943",
+ "07-OCT-1943",
+ "17-MAR-1992",
+ "25-FEB-1996",
+ "29-SEP-1941",
+ "19-APR-1943",
+ "07-OCT-1943",
+ "17-MAR-1992",
+ "25-FEB-1996",
+ "10-NOV-2038",
+ "18-JUL-2094",
+ ],
+ );
+ }
+
+ #[test]
+ fn adate8() {
+ test_dates(
+ Format::new(Type::ADate, 8, 0).unwrap(),
+ &[
+ "********", "********", "********", "********", "********", "********", "********",
+ "********", "09/29/41", "04/19/43", "10/07/43", "03/17/92", "02/25/96", "09/29/41",
+ "04/19/43", "10/07/43", "03/17/92", "02/25/96", "********", "********",
+ ],
+ );
+ }
+
+ #[test]
+ fn adate10() {
+ test_dates(
+ Format::new(Type::ADate, 10, 0).unwrap(),
+ &[
+ "06/10/1648",
+ "06/30/1680",
+ "07/24/1716",
+ "06/19/1768",
+ "08/02/1819",
+ "03/27/1839",
+ "04/19/1903",
+ "08/25/1929",
+ "09/29/1941",
+ "04/19/1943",
+ "10/07/1943",
+ "03/17/1992",
+ "02/25/1996",
+ "09/29/1941",
+ "04/19/1943",
+ "10/07/1943",
+ "03/17/1992",
+ "02/25/1996",
+ "11/10/2038",
+ "07/18/2094",
+ ],
+ );
+ }
+
+ #[test]
+ fn edate8() {
+ test_dates(
+ Format::new(Type::EDate, 8, 0).unwrap(),
+ &[
+ "********", "********", "********", "********", "********", "********", "********",
+ "********", "29.09.41", "19.04.43", "07.10.43", "17.03.92", "25.02.96", "29.09.41",
+ "19.04.43", "07.10.43", "17.03.92", "25.02.96", "********", "********",
+ ],
+ );
+ }
+
+ #[test]
+ fn edate10() {
+ test_dates(
+ Format::new(Type::EDate, 10, 0).unwrap(),
+ &[
+ "10.06.1648",
+ "30.06.1680",
+ "24.07.1716",
+ "19.06.1768",
+ "02.08.1819",
+ "27.03.1839",
+ "19.04.1903",
+ "25.08.1929",
+ "29.09.1941",
+ "19.04.1943",
+ "07.10.1943",
+ "17.03.1992",
+ "25.02.1996",
+ "29.09.1941",
+ "19.04.1943",
+ "07.10.1943",
+ "17.03.1992",
+ "25.02.1996",
+ "10.11.2038",
+ "18.07.2094",
+ ],
+ );
+ }
+
+ #[test]
+ fn jdate5() {
+ test_dates(
+ Format::new(Type::JDate, 5, 0).unwrap(),
+ &[
+ "*****", "*****", "*****", "*****", "*****", "*****", "*****", "*****", "41272",
+ "43109", "43280", "92077", "96056", "41272", "43109", "43280", "92077", "96056",
+ "*****", "*****",
+ ],
+ );
+ }
+
+ #[test]
+ fn jdate7() {
+ test_dates(
+ Format::new(Type::JDate, 7, 0).unwrap(),
+ &[
+ "1648162", "1680182", "1716206", "1768171", "1819214", "1839086", "1903109",
+ "1929237", "1941272", "1943109", "1943280", "1992077", "1996056", "1941272",
+ "1943109", "1943280", "1992077", "1996056", "2038314", "2094199",
+ ],
+ );
+ }
+
+ #[test]
+ fn sdate8() {
+ test_dates(
+ Format::new(Type::SDate, 8, 0).unwrap(),
+ &[
+ "********", "********", "********", "********", "********", "********", "********",
+ "********", "41/09/29", "43/04/19", "43/10/07", "92/03/17", "96/02/25", "41/09/29",
+ "43/04/19", "43/10/07", "92/03/17", "96/02/25", "********", "********",
+ ],
+ );
+ }
+
+ #[test]
+ fn sdate10() {
+ test_dates(
+ Format::new(Type::SDate, 10, 0).unwrap(),
+ &[
+ "1648/06/10",
+ "1680/06/30",
+ "1716/07/24",
+ "1768/06/19",
+ "1819/08/02",
+ "1839/03/27",
+ "1903/04/19",
+ "1929/08/25",
+ "1941/09/29",
+ "1943/04/19",
+ "1943/10/07",
+ "1992/03/17",
+ "1996/02/25",
+ "1941/09/29",
+ "1943/04/19",
+ "1943/10/07",
+ "1992/03/17",
+ "1996/02/25",
+ "2038/11/10",
+ "2094/07/18",
+ ],
+ );
+ }
+
+ #[test]
+ fn qyr6() {
+ test_dates(
+ Format::new(Type::QYr, 6, 0).unwrap(),
+ &[
+ "******", "******", "******", "******", "******", "******", "******", "******",
+ "3 Q 41", "2 Q 43", "4 Q 43", "1 Q 92", "1 Q 96", "3 Q 41", "2 Q 43", "4 Q 43",
+ "1 Q 92", "1 Q 96", "******", "******",
+ ],
+ );
+ }
+
+ #[test]
+ fn qyr8() {
+ test_dates(
+ Format::new(Type::QYr, 8, 0).unwrap(),
+ &[
+ "2 Q 1648", "2 Q 1680", "3 Q 1716", "2 Q 1768", "3 Q 1819", "1 Q 1839", "2 Q 1903",
+ "3 Q 1929", "3 Q 1941", "2 Q 1943", "4 Q 1943", "1 Q 1992", "1 Q 1996", "3 Q 1941",
+ "2 Q 1943", "4 Q 1943", "1 Q 1992", "1 Q 1996", "4 Q 2038", "3 Q 2094",
+ ],
+ );
+ }
+
+ #[test]
+ fn moyr6() {
+ test_dates(
+ Format::new(Type::MoYr, 6, 0).unwrap(),
+ &[
+ "******", "******", "******", "******", "******", "******", "******", "******",
+ "SEP 41", "APR 43", "OCT 43", "MAR 92", "FEB 96", "SEP 41", "APR 43", "OCT 43",
+ "MAR 92", "FEB 96", "******", "******",
+ ],
+ );
+ }
+
+ #[test]
+ fn moyr8() {
+ test_dates(
+ Format::new(Type::MoYr, 8, 0).unwrap(),
+ &[
+ "JUN 1648", "JUN 1680", "JUL 1716", "JUN 1768", "AUG 1819", "MAR 1839", "APR 1903",
+ "AUG 1929", "SEP 1941", "APR 1943", "OCT 1943", "MAR 1992", "FEB 1996", "SEP 1941",
+ "APR 1943", "OCT 1943", "MAR 1992", "FEB 1996", "NOV 2038", "JUL 2094",
+ ],
+ );
+ }
+
+ #[test]
+ fn wkyr8() {
+ test_dates(
+ Format::new(Type::WkYr, 8, 0).unwrap(),
+ &[
+ "********", "********", "********", "********", "********", "********", "********",
+ "********", "39 WK 41", "16 WK 43", "40 WK 43", "11 WK 92", " 8 WK 96", "39 WK 41",
+ "16 WK 43", "40 WK 43", "11 WK 92", " 8 WK 96", "********", "********",
+ ],
+ );
+ }
+
+ #[test]
+ fn wkyr10() {
+ test_dates(
+ Format::new(Type::WkYr, 10, 0).unwrap(),
+ &[
+ "24 WK 1648",
+ "26 WK 1680",
+ "30 WK 1716",
+ "25 WK 1768",
+ "31 WK 1819",
+ "13 WK 1839",
+ "16 WK 1903",
+ "34 WK 1929",
+ "39 WK 1941",
+ "16 WK 1943",
+ "40 WK 1943",
+ "11 WK 1992",
+ " 8 WK 1996",
+ "39 WK 1941",
+ "16 WK 1943",
+ "40 WK 1943",
+ "11 WK 1992",
+ " 8 WK 1996",
+ "45 WK 2038",
+ "29 WK 2094",
+ ],
+ );
+ }
+
+ #[test]
+ fn datetime17() {
+ test_dates(
+ Format::new(Type::DateTime, 17, 0).unwrap(),
+ &[
+ "10-JUN-1648 00:00",
+ "30-JUN-1680 04:50",
+ "24-JUL-1716 12:31",
+ "19-JUN-1768 12:47",
+ "02-AUG-1819 01:26",
+ "27-MAR-1839 20:58",
+ "19-APR-1903 07:36",
+ "25-AUG-1929 15:43",
+ "29-SEP-1941 04:25",
+ "19-APR-1943 06:49",
+ "07-OCT-1943 02:57",
+ "17-MAR-1992 16:45",
+ "25-FEB-1996 21:30",
+ "29-SEP-1941 04:25",
+ "19-APR-1943 06:49",
+ "07-OCT-1943 02:57",
+ "17-MAR-1992 16:45",
+ "25-FEB-1996 21:30",
+ "10-NOV-2038 22:30",
+ "18-JUL-2094 01:56",
+ ],
+ );
+ }
+
+ #[test]
+ fn datetime18() {
+ test_dates(
+ Format::new(Type::DateTime, 18, 0).unwrap(),
+ &[
+ " 10-JUN-1648 00:00",
+ " 30-JUN-1680 04:50",
+ " 24-JUL-1716 12:31",
+ " 19-JUN-1768 12:47",
+ " 02-AUG-1819 01:26",
+ " 27-MAR-1839 20:58",
+ " 19-APR-1903 07:36",
+ " 25-AUG-1929 15:43",
+ " 29-SEP-1941 04:25",
+ " 19-APR-1943 06:49",
+ " 07-OCT-1943 02:57",
+ " 17-MAR-1992 16:45",
+ " 25-FEB-1996 21:30",
+ " 29-SEP-1941 04:25",
+ " 19-APR-1943 06:49",
+ " 07-OCT-1943 02:57",
+ " 17-MAR-1992 16:45",
+ " 25-FEB-1996 21:30",
+ " 10-NOV-2038 22:30",
+ " 18-JUL-2094 01:56",
+ ],
+ );
+ }
+
+ #[test]
+ fn datetime19() {
+ test_dates(
+ Format::new(Type::DateTime, 19, 0).unwrap(),
+ &[
+ " 10-JUN-1648 00:00",
+ " 30-JUN-1680 04:50",
+ " 24-JUL-1716 12:31",
+ " 19-JUN-1768 12:47",
+ " 02-AUG-1819 01:26",
+ " 27-MAR-1839 20:58",
+ " 19-APR-1903 07:36",
+ " 25-AUG-1929 15:43",
+ " 29-SEP-1941 04:25",
+ " 19-APR-1943 06:49",
+ " 07-OCT-1943 02:57",
+ " 17-MAR-1992 16:45",
+ " 25-FEB-1996 21:30",
+ " 29-SEP-1941 04:25",
+ " 19-APR-1943 06:49",
+ " 07-OCT-1943 02:57",
+ " 17-MAR-1992 16:45",
+ " 25-FEB-1996 21:30",
+ " 10-NOV-2038 22:30",
+ " 18-JUL-2094 01:56",
+ ],
+ );
+ }
+
+ #[test]
+ fn datetime20() {
+ test_dates(
+ Format::new(Type::DateTime, 20, 0).unwrap(),
+ &[
+ "10-JUN-1648 00:00:00",
+ "30-JUN-1680 04:50:38",
+ "24-JUL-1716 12:31:35",
+ "19-JUN-1768 12:47:53",
+ "02-AUG-1819 01:26:00",
+ "27-MAR-1839 20:58:11",
+ "19-APR-1903 07:36:05",
+ "25-AUG-1929 15:43:49",
+ "29-SEP-1941 04:25:09",
+ "19-APR-1943 06:49:27",
+ "07-OCT-1943 02:57:52",
+ "17-MAR-1992 16:45:44",
+ "25-FEB-1996 21:30:57",
+ "29-SEP-1941 04:25:09",
+ "19-APR-1943 06:49:27",
+ "07-OCT-1943 02:57:52",
+ "17-MAR-1992 16:45:44",
+ "25-FEB-1996 21:30:57",
+ "10-NOV-2038 22:30:04",
+ "18-JUL-2094 01:56:51",
+ ],
+ );
+ }
+
+ #[test]
+ fn datetime21() {
+ test_dates(
+ Format::new(Type::DateTime, 21, 0).unwrap(),
+ &[
+ " 10-JUN-1648 00:00:00",
+ " 30-JUN-1680 04:50:38",
+ " 24-JUL-1716 12:31:35",
+ " 19-JUN-1768 12:47:53",
+ " 02-AUG-1819 01:26:00",
+ " 27-MAR-1839 20:58:11",
+ " 19-APR-1903 07:36:05",
+ " 25-AUG-1929 15:43:49",
+ " 29-SEP-1941 04:25:09",
+ " 19-APR-1943 06:49:27",
+ " 07-OCT-1943 02:57:52",
+ " 17-MAR-1992 16:45:44",
+ " 25-FEB-1996 21:30:57",
+ " 29-SEP-1941 04:25:09",
+ " 19-APR-1943 06:49:27",
+ " 07-OCT-1943 02:57:52",
+ " 17-MAR-1992 16:45:44",
+ " 25-FEB-1996 21:30:57",
+ " 10-NOV-2038 22:30:04",
+ " 18-JUL-2094 01:56:51",
+ ],
+ );
+ }
+
+ #[test]
+ fn datetime22() {
+ test_dates(
+ Format::new(Type::DateTime, 22, 0).unwrap(),
+ &[
+ " 10-JUN-1648 00:00:00",
+ " 30-JUN-1680 04:50:38",
+ " 24-JUL-1716 12:31:35",
+ " 19-JUN-1768 12:47:53",
+ " 02-AUG-1819 01:26:00",
+ " 27-MAR-1839 20:58:11",
+ " 19-APR-1903 07:36:05",
+ " 25-AUG-1929 15:43:49",
+ " 29-SEP-1941 04:25:09",
+ " 19-APR-1943 06:49:27",
+ " 07-OCT-1943 02:57:52",
+ " 17-MAR-1992 16:45:44",
+ " 25-FEB-1996 21:30:57",
+ " 29-SEP-1941 04:25:09",
+ " 19-APR-1943 06:49:27",
+ " 07-OCT-1943 02:57:52",
+ " 17-MAR-1992 16:45:44",
+ " 25-FEB-1996 21:30:57",
+ " 10-NOV-2038 22:30:04",
+ " 18-JUL-2094 01:56:51",
+ ],
+ );
+ }
+
+ #[test]
+ fn datetime22_1() {
+ test_dates(
+ Format::new(Type::DateTime, 22, 1).unwrap(),
+ &[
+ "10-JUN-1648 00:00:00.0",
+ "30-JUN-1680 04:50:38.1",
+ "24-JUL-1716 12:31:35.2",
+ "19-JUN-1768 12:47:53.3",
+ "02-AUG-1819 01:26:00.5",
+ "27-MAR-1839 20:58:11.6",
+ "19-APR-1903 07:36:05.2",
+ "25-AUG-1929 15:43:49.8",
+ "29-SEP-1941 04:25:09.0",
+ "19-APR-1943 06:49:27.5",
+ "07-OCT-1943 02:57:52.0",
+ "17-MAR-1992 16:45:44.9",
+ "25-FEB-1996 21:30:57.8",
+ "29-SEP-1941 04:25:09.2",
+ "19-APR-1943 06:49:27.1",
+ "07-OCT-1943 02:57:52.5",
+ "17-MAR-1992 16:45:44.7",
+ "25-FEB-1996 21:30:57.6",
+ "10-NOV-2038 22:30:04.2",
+ "18-JUL-2094 01:56:51.6",
+ ],
+ );
+ }
+
+ #[test]
+ fn datetime23_2() {
+ test_dates(
+ Format::new(Type::DateTime, 23, 2).unwrap(),
+ &[
+ "10-JUN-1648 00:00:00.00",
+ "30-JUN-1680 04:50:38.12",
+ "24-JUL-1716 12:31:35.23",
+ "19-JUN-1768 12:47:53.35",
+ "02-AUG-1819 01:26:00.46",
+ "27-MAR-1839 20:58:11.57",
+ "19-APR-1903 07:36:05.19",
+ "25-AUG-1929 15:43:49.83",
+ "29-SEP-1941 04:25:09.01",
+ "19-APR-1943 06:49:27.52",
+ "07-OCT-1943 02:57:52.02",
+ "17-MAR-1992 16:45:44.87",
+ "25-FEB-1996 21:30:57.82",
+ "29-SEP-1941 04:25:09.15",
+ "19-APR-1943 06:49:27.11",
+ "07-OCT-1943 02:57:52.48",
+ "17-MAR-1992 16:45:44.66",
+ "25-FEB-1996 21:30:57.58",
+ "10-NOV-2038 22:30:04.18",
+ "18-JUL-2094 01:56:51.59",
+ ],
+ );
+ }
+
+ #[test]
+ fn datetime24_3() {
+ test_dates(
+ Format::new(Type::DateTime, 24, 3).unwrap(),
+ &[
+ "10-JUN-1648 00:00:00.000",
+ "30-JUN-1680 04:50:38.123",
+ "24-JUL-1716 12:31:35.235",
+ "19-JUN-1768 12:47:53.345",
+ "02-AUG-1819 01:26:00.456",
+ "27-MAR-1839 20:58:11.567",
+ "19-APR-1903 07:36:05.190",
+ "25-AUG-1929 15:43:49.831",
+ "29-SEP-1941 04:25:09.013",
+ "19-APR-1943 06:49:27.524",
+ "07-OCT-1943 02:57:52.016",
+ "17-MAR-1992 16:45:44.865",
+ "25-FEB-1996 21:30:57.820",
+ "29-SEP-1941 04:25:09.154",
+ "19-APR-1943 06:49:27.105",
+ "07-OCT-1943 02:57:52.482",
+ "17-MAR-1992 16:45:44.658",
+ "25-FEB-1996 21:30:57.582",
+ "10-NOV-2038 22:30:04.183",
+ "18-JUL-2094 01:56:51.593",
+ ],
+ );
+ }
+
+ #[test]
+ fn datetime25_4() {
+ test_dates(
+ Format::new(Type::DateTime, 25, 4).unwrap(),
+ &[
+ "10-JUN-1648 00:00:00.0000",
+ "30-JUN-1680 04:50:38.1230",
+ "24-JUL-1716 12:31:35.2345",
+ "19-JUN-1768 12:47:53.3450",
+ "02-AUG-1819 01:26:00.4562",
+ "27-MAR-1839 20:58:11.5668",
+ "19-APR-1903 07:36:05.1896",
+ "25-AUG-1929 15:43:49.8313",
+ "29-SEP-1941 04:25:09.0129",
+ "19-APR-1943 06:49:27.5238",
+ "07-OCT-1943 02:57:52.0156",
+ "17-MAR-1992 16:45:44.8653",
+ "25-FEB-1996 21:30:57.8205",
+ "29-SEP-1941 04:25:09.1539",
+ "19-APR-1943 06:49:27.1053",
+ "07-OCT-1943 02:57:52.4823",
+ "17-MAR-1992 16:45:44.6583",
+ "25-FEB-1996 21:30:57.5822",
+ "10-NOV-2038 22:30:04.1835",
+ "18-JUL-2094 01:56:51.5932",
+ ],
+ );
+ }
+
+ #[test]
+ fn datetime26_5() {
+ test_dates(
+ Format::new(Type::DateTime, 26, 5).unwrap(),
+ &[
+ "10-JUN-1648 00:00:00.00000",
+ "30-JUN-1680 04:50:38.12301",
+ "24-JUL-1716 12:31:35.23453",
+ "19-JUN-1768 12:47:53.34505",
+ "02-AUG-1819 01:26:00.45615",
+ "27-MAR-1839 20:58:11.56677",
+ "19-APR-1903 07:36:05.18964",
+ "25-AUG-1929 15:43:49.83132",
+ "29-SEP-1941 04:25:09.01293",
+ "19-APR-1943 06:49:27.52375",
+ "07-OCT-1943 02:57:52.01565",
+ "17-MAR-1992 16:45:44.86529",
+ "25-FEB-1996 21:30:57.82047",
+ "29-SEP-1941 04:25:09.15395",
+ "19-APR-1943 06:49:27.10533",
+ "07-OCT-1943 02:57:52.48229",
+ "17-MAR-1992 16:45:44.65827",
+ "25-FEB-1996 21:30:57.58219",
+ "10-NOV-2038 22:30:04.18347",
+ "18-JUL-2094 01:56:51.59319",
+ ],
+ );
+ }
+
+ #[test]
+ fn ymdhms16() {
+ test_dates(
+ Format::new(Type::YmdHms, 16, 0).unwrap(),
+ &[
+ "1648-06-10 00:00",
+ "1680-06-30 04:50",
+ "1716-07-24 12:31",
+ "1768-06-19 12:47",
+ "1819-08-02 01:26",
+ "1839-03-27 20:58",
+ "1903-04-19 07:36",
+ "1929-08-25 15:43",
+ "1941-09-29 04:25",
+ "1943-04-19 06:49",
+ "1943-10-07 02:57",
+ "1992-03-17 16:45",
+ "1996-02-25 21:30",
+ "1941-09-29 04:25",
+ "1943-04-19 06:49",
+ "1943-10-07 02:57",
+ "1992-03-17 16:45",
+ "1996-02-25 21:30",
+ "2038-11-10 22:30",
+ "2094-07-18 01:56",
+ ],
+ );
+ }
+
+ #[test]
+ fn ymdhms17() {
+ test_dates(
+ Format::new(Type::YmdHms, 17, 0).unwrap(),
+ &[
+ " 1648-06-10 00:00",
+ " 1680-06-30 04:50",
+ " 1716-07-24 12:31",
+ " 1768-06-19 12:47",
+ " 1819-08-02 01:26",
+ " 1839-03-27 20:58",
+ " 1903-04-19 07:36",
+ " 1929-08-25 15:43",
+ " 1941-09-29 04:25",
+ " 1943-04-19 06:49",
+ " 1943-10-07 02:57",
+ " 1992-03-17 16:45",
+ " 1996-02-25 21:30",
+ " 1941-09-29 04:25",
+ " 1943-04-19 06:49",
+ " 1943-10-07 02:57",
+ " 1992-03-17 16:45",
+ " 1996-02-25 21:30",
+ " 2038-11-10 22:30",
+ " 2094-07-18 01:56",
+ ],
+ );
+ }
+
+ #[test]
+ fn ymdhms18() {
+ test_dates(
+ Format::new(Type::YmdHms, 18, 0).unwrap(),
+ &[
+ " 1648-06-10 00:00",
+ " 1680-06-30 04:50",
+ " 1716-07-24 12:31",
+ " 1768-06-19 12:47",
+ " 1819-08-02 01:26",
+ " 1839-03-27 20:58",
+ " 1903-04-19 07:36",
+ " 1929-08-25 15:43",
+ " 1941-09-29 04:25",
+ " 1943-04-19 06:49",
+ " 1943-10-07 02:57",
+ " 1992-03-17 16:45",
+ " 1996-02-25 21:30",
+ " 1941-09-29 04:25",
+ " 1943-04-19 06:49",
+ " 1943-10-07 02:57",
+ " 1992-03-17 16:45",
+ " 1996-02-25 21:30",
+ " 2038-11-10 22:30",
+ " 2094-07-18 01:56",
+ ],
+ );
+ }
+
+ #[test]
+ fn ymdhms19() {
+ test_dates(
+ Format::new(Type::YmdHms, 19, 0).unwrap(),
+ &[
+ "1648-06-10 00:00:00",
+ "1680-06-30 04:50:38",
+ "1716-07-24 12:31:35",
+ "1768-06-19 12:47:53",
+ "1819-08-02 01:26:00",
+ "1839-03-27 20:58:11",
+ "1903-04-19 07:36:05",
+ "1929-08-25 15:43:49",
+ "1941-09-29 04:25:09",
+ "1943-04-19 06:49:27",
+ "1943-10-07 02:57:52",
+ "1992-03-17 16:45:44",
+ "1996-02-25 21:30:57",
+ "1941-09-29 04:25:09",
+ "1943-04-19 06:49:27",
+ "1943-10-07 02:57:52",
+ "1992-03-17 16:45:44",
+ "1996-02-25 21:30:57",
+ "2038-11-10 22:30:04",
+ "2094-07-18 01:56:51",
+ ],
+ );
+ }
+
+ #[test]
+ fn ymdhms20() {
+ test_dates(
+ Format::new(Type::YmdHms, 20, 0).unwrap(),
+ &[
+ " 1648-06-10 00:00:00",
+ " 1680-06-30 04:50:38",
+ " 1716-07-24 12:31:35",
+ " 1768-06-19 12:47:53",
+ " 1819-08-02 01:26:00",
+ " 1839-03-27 20:58:11",
+ " 1903-04-19 07:36:05",
+ " 1929-08-25 15:43:49",
+ " 1941-09-29 04:25:09",
+ " 1943-04-19 06:49:27",
+ " 1943-10-07 02:57:52",
+ " 1992-03-17 16:45:44",
+ " 1996-02-25 21:30:57",
+ " 1941-09-29 04:25:09",
+ " 1943-04-19 06:49:27",
+ " 1943-10-07 02:57:52",
+ " 1992-03-17 16:45:44",
+ " 1996-02-25 21:30:57",
+ " 2038-11-10 22:30:04",
+ " 2094-07-18 01:56:51",
+ ],
+ );
+ }
+
+ #[test]
+ fn ymdhms21() {
+ test_dates(
+ Format::new(Type::YmdHms, 21, 0).unwrap(),
+ &[
+ " 1648-06-10 00:00:00",
+ " 1680-06-30 04:50:38",
+ " 1716-07-24 12:31:35",
+ " 1768-06-19 12:47:53",
+ " 1819-08-02 01:26:00",
+ " 1839-03-27 20:58:11",
+ " 1903-04-19 07:36:05",
+ " 1929-08-25 15:43:49",
+ " 1941-09-29 04:25:09",
+ " 1943-04-19 06:49:27",
+ " 1943-10-07 02:57:52",
+ " 1992-03-17 16:45:44",
+ " 1996-02-25 21:30:57",
+ " 1941-09-29 04:25:09",
+ " 1943-04-19 06:49:27",
+ " 1943-10-07 02:57:52",
+ " 1992-03-17 16:45:44",
+ " 1996-02-25 21:30:57",
+ " 2038-11-10 22:30:04",
+ " 2094-07-18 01:56:51",
+ ],
+ );
+ }
+
+ #[test]
+ fn ymdhms21_1() {
+ test_dates(
+ Format::new(Type::YmdHms, 21, 1).unwrap(),
+ &[
+ "1648-06-10 00:00:00.0",
+ "1680-06-30 04:50:38.1",
+ "1716-07-24 12:31:35.2",
+ "1768-06-19 12:47:53.3",
+ "1819-08-02 01:26:00.5",
+ "1839-03-27 20:58:11.6",
+ "1903-04-19 07:36:05.2",
+ "1929-08-25 15:43:49.8",
+ "1941-09-29 04:25:09.0",
+ "1943-04-19 06:49:27.5",
+ "1943-10-07 02:57:52.0",
+ "1992-03-17 16:45:44.9",
+ "1996-02-25 21:30:57.8",
+ "1941-09-29 04:25:09.2",
+ "1943-04-19 06:49:27.1",
+ "1943-10-07 02:57:52.5",
+ "1992-03-17 16:45:44.7",
+ "1996-02-25 21:30:57.6",
+ "2038-11-10 22:30:04.2",
+ "2094-07-18 01:56:51.6",
+ ],
+ );
+ }
+
+ #[test]
+ fn ymdhms22_2() {
+ test_dates(
+ Format::new(Type::YmdHms, 22, 2).unwrap(),
+ &[
+ "1648-06-10 00:00:00.00",
+ "1680-06-30 04:50:38.12",
+ "1716-07-24 12:31:35.23",
+ "1768-06-19 12:47:53.35",
+ "1819-08-02 01:26:00.46",
+ "1839-03-27 20:58:11.57",
+ "1903-04-19 07:36:05.19",
+ "1929-08-25 15:43:49.83",
+ "1941-09-29 04:25:09.01",
+ "1943-04-19 06:49:27.52",
+ "1943-10-07 02:57:52.02",
+ "1992-03-17 16:45:44.87",
+ "1996-02-25 21:30:57.82",
+ "1941-09-29 04:25:09.15",
+ "1943-04-19 06:49:27.11",
+ "1943-10-07 02:57:52.48",
+ "1992-03-17 16:45:44.66",
+ "1996-02-25 21:30:57.58",
+ "2038-11-10 22:30:04.18",
+ "2094-07-18 01:56:51.59",
+ ],
+ );
+ }
+
+ #[test]
+ fn ymdhms23_3() {
+ test_dates(
+ Format::new(Type::YmdHms, 23, 3).unwrap(),
+ &[
+ "1648-06-10 00:00:00.000",
+ "1680-06-30 04:50:38.123",
+ "1716-07-24 12:31:35.235",
+ "1768-06-19 12:47:53.345",
+ "1819-08-02 01:26:00.456",
+ "1839-03-27 20:58:11.567",
+ "1903-04-19 07:36:05.190",
+ "1929-08-25 15:43:49.831",
+ "1941-09-29 04:25:09.013",
+ "1943-04-19 06:49:27.524",
+ "1943-10-07 02:57:52.016",
+ "1992-03-17 16:45:44.865",
+ "1996-02-25 21:30:57.820",
+ "1941-09-29 04:25:09.154",
+ "1943-04-19 06:49:27.105",
+ "1943-10-07 02:57:52.482",
+ "1992-03-17 16:45:44.658",
+ "1996-02-25 21:30:57.582",
+ "2038-11-10 22:30:04.183",
+ "2094-07-18 01:56:51.593",
+ ],
+ );
+ }
+
+ #[test]
+ fn ymdhms24_4() {
+ test_dates(
+ Format::new(Type::YmdHms, 24, 4).unwrap(),
+ &[
+ "1648-06-10 00:00:00.0000",
+ "1680-06-30 04:50:38.1230",
+ "1716-07-24 12:31:35.2345",
+ "1768-06-19 12:47:53.3450",
+ "1819-08-02 01:26:00.4562",
+ "1839-03-27 20:58:11.5668",
+ "1903-04-19 07:36:05.1896",
+ "1929-08-25 15:43:49.8313",
+ "1941-09-29 04:25:09.0129",
+ "1943-04-19 06:49:27.5238",
+ "1943-10-07 02:57:52.0156",
+ "1992-03-17 16:45:44.8653",
+ "1996-02-25 21:30:57.8205",
+ "1941-09-29 04:25:09.1539",
+ "1943-04-19 06:49:27.1053",
+ "1943-10-07 02:57:52.4823",
+ "1992-03-17 16:45:44.6583",
+ "1996-02-25 21:30:57.5822",
+ "2038-11-10 22:30:04.1835",
+ "2094-07-18 01:56:51.5932",
+ ],
+ );
+ }
+
+ #[test]
+ fn ymdhms25_5() {
+ test_dates(
+ Format::new(Type::YmdHms, 25, 5).unwrap(),
+ &[
+ "1648-06-10 00:00:00.00000",
+ "1680-06-30 04:50:38.12301",
+ "1716-07-24 12:31:35.23453",
+ "1768-06-19 12:47:53.34505",
+ "1819-08-02 01:26:00.45615",
+ "1839-03-27 20:58:11.56677",
+ "1903-04-19 07:36:05.18964",
+ "1929-08-25 15:43:49.83132",
+ "1941-09-29 04:25:09.01293",
+ "1943-04-19 06:49:27.52375",
+ "1943-10-07 02:57:52.01565",
+ "1992-03-17 16:45:44.86529",
+ "1996-02-25 21:30:57.82047",
+ "1941-09-29 04:25:09.15395",
+ "1943-04-19 06:49:27.10533",
+ "1943-10-07 02:57:52.48229",
+ "1992-03-17 16:45:44.65827",
+ "1996-02-25 21:30:57.58219",
+ "2038-11-10 22:30:04.18347",
+ "2094-07-18 01:56:51.59319",
+ ],
+ );
+ }
}