1
0
mirror of https://github.com/bspeice/dtparse synced 2025-07-01 05:46:14 -04:00

Redo the tokenization

Still has issues with one test case for fuzzy
This commit is contained in:
Bradlee Speice
2018-07-07 23:37:02 -04:00
committed by Bradlee Speice
parent 9135962839
commit e049618fff
9 changed files with 1029 additions and 155 deletions

17
src/tests/fuzzing.rs Normal file
View File

@ -0,0 +1,17 @@
use chrono::NaiveDate;
use std::collections::HashMap;
use parse;
use ParseError;
use Parser;
#[test]
fn test_fuzz() {
assert_eq!(parse("\x2D\x38\x31\x39\x34\x38\x34"), Err(ParseError::InvalidMonth));
let default = NaiveDate::from_ymd(2016, 6, 29).and_hms(0, 0, 0);
let mut p = Parser::default();
let res = p.parse("\x0D\x31", None, None, false, false, Some(&default), false, HashMap::new()).unwrap();
assert_eq!(res.0, default);
}