use crate::*;
use NthWeekday::*;
holiday_const!(
MLKJ_DAY, "Martin Luther King Jr. Day", Third, Weekday::Mon, January
);
holiday_const!(
GROUNDHOG_DAY, "Groundhog Day", February, 2
);
holiday_const!(
SUPERBOWL_SUNDAY, "Super Bowl Sunday", First, Weekday::Sun, February
);
holiday_const!(
PRESIDENTS_DAY, "President's Day", Third, Weekday::Mon, February
);
holiday_const!(
VALENTINES_DAY, "Valentine's Day", February, 14
);
holiday_const!(
DST_START, "Daylight Saving Time Starts", Second, Weekday::Sun, March
);
holiday_const!(
APRIL_FOOLS_DAY, "April Fool's Day", April, 1
);
holiday_const!(
KENTUCKY_DERBY, "Kentucky Derby", First, Weekday::Sat, May
);
holiday_const!(
MEMORIAL_DAY, "Memorial Day", Last, Weekday::Mon, May
);
holiday_const!(
MOTHERS_DAY, "Mother's Day", Second, Weekday::Sun, May
);
holiday_const!(
FLAG_DAY, "Flag Day", June, 14
);
holiday_const!(
INDEPENDENCE_DAY, "Independence Day", July, 4
);
holiday_const!(
FATHERS_DAY, "Father's Day", Third, Weekday::Sun, June
);
holiday_const!(
LABOR_DAY, "Labor Day", First, Weekday::Mon, September
);
holiday_const!(
HALLOWEEN, "Halloween", October, 31
);
holiday_const!(
COLUMBUS_DAY, "Columbus Day", Second, Weekday::Mon, October
);
holiday_const!(
VETERANS_DAY, "Veteran's Day", November, 11
);
holiday_const!(
DST_END, "Daylight Saving Time Ends", First, Weekday::Sun, November
);
holiday_const!(
THANKSGIVING, "Thanksgiving", Fourth, Weekday::Thu, November
);
#[test]
fn holiday_eq() {
assert_eq!(THANKSGIVING, NthWeekdayOfMonth::new(4, Weekday::Thu, 11));
assert_eq!(THANKSGIVING, NaiveDate::from_ymd(2020, 11, 26));
assert_eq!(THANKSGIVING, NaiveDate::from_ymd(2021, 11, 25));
assert_eq!(HALLOWEEN, NaiveDate::from_ymd(2020, 10, 31));
assert_eq!(HALLOWEEN, NaiveDate::from_ymd(2021, 10, 31));
}
#[test]
fn holiday_ord() {
let mut vec = vec![
super::global::NEW_YEARS_EVE,
THANKSGIVING,
super::global::NEW_YEARS_DAY,
HALLOWEEN,
super::global::CHRISTMAS,
];
vec.sort();
dbg!(&vec);
let exp = vec![
super::global::NEW_YEARS_DAY,
HALLOWEEN,
THANKSGIVING,
super::global::CHRISTMAS,
super::global::NEW_YEARS_EVE,
];
assert_eq!(vec, exp);
}