add tests for days of the week

This commit is contained in:
Savanni D'Gerinel 2023-08-03 22:11:11 -04:00
parent a1cae2ed2b
commit 52ae75ca5c
2 changed files with 15 additions and 418 deletions

View File

@ -131,31 +131,6 @@ rec {
"rustc-dep-of-std" = [ "core" "compiler_builtins" ];
};
};
"aho-corasick" = rec {
crateName = "aho-corasick";
version = "1.0.2";
edition = "2021";
sha256 = "0has59a3571irggpk5z8c0lpnx8kdx12qf4g2x0560i2y8dwpxj3";
libName = "aho_corasick";
authors = [
"Andrew Gallant <jamslam@gmail.com>"
];
dependencies = [
{
name = "memchr";
packageId = "memchr";
optional = true;
usesDefaultFeatures = false;
}
];
features = {
"default" = [ "std" "perf-literal" ];
"logging" = [ "dep:log" ];
"perf-literal" = [ "dep:memchr" ];
"std" = [ "memchr?/std" ];
};
resolvedDefaultFeatures = [ "default" "perf-literal" "std" ];
};
"android-tzdata" = rec {
crateName = "android-tzdata";
version = "0.1.1";
@ -470,76 +445,6 @@ rec {
};
resolvedDefaultFeatures = [ "clock" "default" "iana-time-zone" "js-sys" "oldtime" "serde" "std" "time" "wasm-bindgen" "wasmbind" "winapi" ];
};
"chrono-tz" = rec {
crateName = "chrono-tz";
version = "0.6.3";
edition = "2015";
sha256 = "1pmv434fhw9pwiqc12pvgaiskrq4v1dh1f238gfsg48r301r5hr9";
dependencies = [
{
name = "chrono";
packageId = "chrono";
usesDefaultFeatures = false;
}
{
name = "phf";
packageId = "phf";
usesDefaultFeatures = false;
features = [ "uncased" ];
}
];
buildDependencies = [
{
name = "chrono-tz-build";
packageId = "chrono-tz-build";
}
];
devDependencies = [
{
name = "chrono";
packageId = "chrono";
usesDefaultFeatures = false;
features = [ "alloc" ];
}
];
features = {
"case-insensitive" = [ "uncased" "chrono-tz-build/case-insensitive" ];
"default" = [ "std" ];
"filter-by-regex" = [ "chrono-tz-build/filter-by-regex" ];
"serde" = [ "dep:serde" ];
"uncased" = [ "dep:uncased" ];
};
resolvedDefaultFeatures = [ "default" "std" ];
};
"chrono-tz-build" = rec {
crateName = "chrono-tz-build";
version = "0.0.3";
edition = "2018";
sha256 = "031s51dd2vbxdhz7fxk1jpbbvr800w57an14bsq3fd5khwx9ql3g";
dependencies = [
{
name = "parse-zoneinfo";
packageId = "parse-zoneinfo";
}
{
name = "phf";
packageId = "phf";
usesDefaultFeatures = false;
features = [ "uncased" ];
}
{
name = "phf_codegen";
packageId = "phf_codegen";
usesDefaultFeatures = false;
}
];
features = {
"case-insensitive" = [ "uncased" ];
"filter-by-regex" = [ "regex" ];
"regex" = [ "dep:regex" ];
"uncased" = [ "dep:uncased" ];
};
};
"core-foundation" = rec {
crateName = "core-foundation";
version = "0.9.3";
@ -644,10 +549,6 @@ rec {
packageId = "chrono";
features = [ "serde" ];
}
{
name = "chrono-tz";
packageId = "chrono-tz";
}
{
name = "fluent";
packageId = "fluent";
@ -2769,24 +2670,6 @@ rec {
"thread-id" = [ "dep:thread-id" ];
};
};
"parse-zoneinfo" = rec {
crateName = "parse-zoneinfo";
version = "0.3.0";
edition = "2015";
sha256 = "0h8g6jy4kckn2gk8sd5adaws180n1ip65xhzw5jxlq4w8ibg41f7";
authors = [
"Djzin <djzin@users.noreply.github.com>"
];
dependencies = [
{
name = "regex";
packageId = "regex";
usesDefaultFeatures = false;
features = [ "std" "unicode-perl" ];
}
];
};
"percent-encoding" = rec {
crateName = "percent-encoding";
version = "2.3.0";
@ -2801,105 +2684,6 @@ rec {
};
resolvedDefaultFeatures = [ "alloc" "default" "std" ];
};
"phf" = rec {
crateName = "phf";
version = "0.11.2";
edition = "2021";
sha256 = "1p03rsw66l7naqhpgr1a34r9yzi1gv9jh16g3fsk6wrwyfwdiqmd";
authors = [
"Steven Fackler <sfackler@gmail.com>"
];
dependencies = [
{
name = "phf_shared";
packageId = "phf_shared";
usesDefaultFeatures = false;
}
];
features = {
"default" = [ "std" ];
"macros" = [ "phf_macros" ];
"phf_macros" = [ "dep:phf_macros" ];
"serde" = [ "dep:serde" ];
"std" = [ "phf_shared/std" ];
"uncased" = [ "phf_shared/uncased" ];
"unicase" = [ "phf_macros?/unicase" "phf_shared/unicase" ];
};
resolvedDefaultFeatures = [ "uncased" ];
};
"phf_codegen" = rec {
crateName = "phf_codegen";
version = "0.11.2";
edition = "2021";
sha256 = "0nia6h4qfwaypvfch3pnq1nd2qj64dif4a6kai3b7rjrsf49dlz8";
authors = [
"Steven Fackler <sfackler@gmail.com>"
];
dependencies = [
{
name = "phf_generator";
packageId = "phf_generator";
}
{
name = "phf_shared";
packageId = "phf_shared";
}
];
};
"phf_generator" = rec {
crateName = "phf_generator";
version = "0.11.2";
edition = "2021";
crateBin = [];
sha256 = "1c14pjyxbcpwkdgw109f7581cc5fa3fnkzdq1ikvx7mdq9jcrr28";
authors = [
"Steven Fackler <sfackler@gmail.com>"
];
dependencies = [
{
name = "phf_shared";
packageId = "phf_shared";
usesDefaultFeatures = false;
}
{
name = "rand";
packageId = "rand";
usesDefaultFeatures = false;
features = [ "small_rng" ];
}
];
features = {
"criterion" = [ "dep:criterion" ];
};
};
"phf_shared" = rec {
crateName = "phf_shared";
version = "0.11.2";
edition = "2021";
sha256 = "0azphb0a330ypqx3qvyffal5saqnks0xvl8rj73jlk3qxxgbkz4h";
authors = [
"Steven Fackler <sfackler@gmail.com>"
];
dependencies = [
{
name = "siphasher";
packageId = "siphasher";
}
{
name = "uncased";
packageId = "uncased";
optional = true;
usesDefaultFeatures = false;
}
];
features = {
"default" = [ "std" ];
"uncased" = [ "dep:uncased" ];
"unicase" = [ "dep:unicase" ];
};
resolvedDefaultFeatures = [ "default" "std" "uncased" ];
};
"pin-project" = rec {
crateName = "pin-project";
version = "1.1.2";
@ -3059,7 +2843,7 @@ rec {
"std" = [ "rand_core/std" "rand_chacha/std" "alloc" "getrandom" "libc" ];
"std_rng" = [ "rand_chacha" ];
};
resolvedDefaultFeatures = [ "alloc" "default" "getrandom" "libc" "rand_chacha" "small_rng" "std" "std_rng" ];
resolvedDefaultFeatures = [ "alloc" "default" "getrandom" "libc" "rand_chacha" "std" "std_rng" ];
};
"rand_chacha" = rec {
crateName = "rand_chacha";
@ -3135,138 +2919,6 @@ rec {
"rustc-dep-of-std" = [ "core" "bitflags/rustc-dep-of-std" ];
};
};
"regex" = rec {
crateName = "regex";
version = "1.9.1";
edition = "2021";
sha256 = "0xdmrvs8fy7yw2bdk76mjbhzqibms7g4ljg468jwzxr0qa7ydsmj";
authors = [
"The Rust Project Developers"
"Andrew Gallant <jamslam@gmail.com>"
];
dependencies = [
{
name = "aho-corasick";
packageId = "aho-corasick";
optional = true;
}
{
name = "memchr";
packageId = "memchr";
optional = true;
}
{
name = "regex-automata";
packageId = "regex-automata";
usesDefaultFeatures = false;
features = [ "alloc" "syntax" "meta" "nfa-pikevm" ];
}
{
name = "regex-syntax";
packageId = "regex-syntax";
usesDefaultFeatures = false;
}
];
features = {
"default" = [ "std" "perf" "unicode" "regex-syntax/default" ];
"logging" = [ "aho-corasick?/logging" "regex-automata/logging" ];
"perf" = [ "perf-cache" "perf-dfa" "perf-onepass" "perf-backtrack" "perf-inline" "perf-literal" ];
"perf-backtrack" = [ "regex-automata/nfa-backtrack" ];
"perf-dfa" = [ "regex-automata/hybrid" ];
"perf-dfa-full" = [ "regex-automata/dfa-build" "regex-automata/dfa-search" ];
"perf-inline" = [ "regex-automata/perf-inline" ];
"perf-literal" = [ "dep:aho-corasick" "dep:memchr" "regex-automata/perf-literal" ];
"perf-onepass" = [ "regex-automata/dfa-onepass" ];
"std" = [ "aho-corasick?/std" "memchr?/std" "regex-automata/std" "regex-syntax/std" ];
"unicode" = [ "unicode-age" "unicode-bool" "unicode-case" "unicode-gencat" "unicode-perl" "unicode-script" "unicode-segment" "regex-automata/unicode" "regex-syntax/unicode" ];
"unicode-age" = [ "regex-automata/unicode-age" "regex-syntax/unicode-age" ];
"unicode-bool" = [ "regex-automata/unicode-bool" "regex-syntax/unicode-bool" ];
"unicode-case" = [ "regex-automata/unicode-case" "regex-syntax/unicode-case" ];
"unicode-gencat" = [ "regex-automata/unicode-gencat" "regex-syntax/unicode-gencat" ];
"unicode-perl" = [ "regex-automata/unicode-perl" "regex-automata/unicode-word-boundary" "regex-syntax/unicode-perl" ];
"unicode-script" = [ "regex-automata/unicode-script" "regex-syntax/unicode-script" ];
"unicode-segment" = [ "regex-automata/unicode-segment" "regex-syntax/unicode-segment" ];
"unstable" = [ "pattern" ];
"use_std" = [ "std" ];
};
resolvedDefaultFeatures = [ "std" "unicode-perl" ];
};
"regex-automata" = rec {
crateName = "regex-automata";
version = "0.3.3";
edition = "2021";
sha256 = "041kj8fnyh3hv8sqmqq1am6agb1ckjxj6swjfcp8qih7vl84qd9r";
authors = [
"The Rust Project Developers"
"Andrew Gallant <jamslam@gmail.com>"
];
dependencies = [
{
name = "aho-corasick";
packageId = "aho-corasick";
optional = true;
usesDefaultFeatures = false;
}
{
name = "memchr";
packageId = "memchr";
optional = true;
usesDefaultFeatures = false;
}
{
name = "regex-syntax";
packageId = "regex-syntax";
optional = true;
usesDefaultFeatures = false;
}
];
features = {
"default" = [ "std" "syntax" "perf" "unicode" "meta" "nfa" "dfa" "hybrid" ];
"dfa" = [ "dfa-build" "dfa-search" "dfa-onepass" ];
"dfa-build" = [ "nfa-thompson" "dfa-search" ];
"dfa-onepass" = [ "nfa-thompson" ];
"hybrid" = [ "alloc" "nfa-thompson" ];
"internal-instrument" = [ "internal-instrument-pikevm" ];
"internal-instrument-pikevm" = [ "logging" "std" ];
"logging" = [ "dep:log" "aho-corasick?/logging" ];
"meta" = [ "syntax" "nfa-pikevm" ];
"nfa" = [ "nfa-thompson" "nfa-pikevm" "nfa-backtrack" ];
"nfa-backtrack" = [ "nfa-thompson" ];
"nfa-pikevm" = [ "nfa-thompson" ];
"nfa-thompson" = [ "alloc" ];
"perf" = [ "perf-inline" "perf-literal" ];
"perf-literal" = [ "perf-literal-substring" "perf-literal-multisubstring" ];
"perf-literal-multisubstring" = [ "std" "dep:aho-corasick" ];
"perf-literal-substring" = [ "aho-corasick?/perf-literal" "dep:memchr" ];
"std" = [ "regex-syntax?/std" "memchr?/std" "aho-corasick?/std" "alloc" ];
"syntax" = [ "dep:regex-syntax" "alloc" ];
"unicode" = [ "unicode-age" "unicode-bool" "unicode-case" "unicode-gencat" "unicode-perl" "unicode-script" "unicode-segment" "unicode-word-boundary" "regex-syntax?/unicode" ];
"unicode-age" = [ "regex-syntax?/unicode-age" ];
"unicode-bool" = [ "regex-syntax?/unicode-bool" ];
"unicode-case" = [ "regex-syntax?/unicode-case" ];
"unicode-gencat" = [ "regex-syntax?/unicode-gencat" ];
"unicode-perl" = [ "regex-syntax?/unicode-perl" ];
"unicode-script" = [ "regex-syntax?/unicode-script" ];
"unicode-segment" = [ "regex-syntax?/unicode-segment" ];
};
resolvedDefaultFeatures = [ "alloc" "meta" "nfa-pikevm" "nfa-thompson" "std" "syntax" "unicode-perl" "unicode-word-boundary" ];
};
"regex-syntax" = rec {
crateName = "regex-syntax";
version = "0.7.4";
edition = "2021";
sha256 = "1qjczlc2w92kamn9ipjdr5pjql0jnccahpi9l3r6wp0rnsjr5sp5";
authors = [
"The Rust Project Developers"
"Andrew Gallant <jamslam@gmail.com>"
];
features = {
"arbitrary" = [ "dep:arbitrary" ];
"default" = [ "std" "unicode" ];
"unicode" = [ "unicode-age" "unicode-bool" "unicode-case" "unicode-gencat" "unicode-perl" "unicode-script" "unicode-segment" ];
};
resolvedDefaultFeatures = [ "std" "unicode-perl" ];
};
"reqwest" = rec {
crateName = "reqwest";
version = "0.11.18";
@ -3983,22 +3635,6 @@ rec {
];
};
"siphasher" = rec {
crateName = "siphasher";
version = "0.3.10";
edition = "2018";
sha256 = "1pi5sb2j2wi92zfqj6qxnk11vk1qq2plya5g2a5kzbwrd0hf7lvv";
authors = [
"Frank Denis <github@pureftpd.org>"
];
features = {
"default" = [ "std" ];
"serde" = [ "dep:serde" ];
"serde_no_std" = [ "serde/alloc" ];
"serde_std" = [ "std" "serde/std" ];
};
resolvedDefaultFeatures = [ "default" "std" ];
};
"slab" = rec {
crateName = "slab";
version = "0.4.8";
@ -4839,27 +4475,6 @@ rec {
"scale_info" = [ "scale-info/derive" ];
};
};
"uncased" = rec {
crateName = "uncased";
version = "0.9.9";
edition = "2018";
sha256 = "0s6ajpdc300jr3fhxgh93lwdfkd88g9amhw6mc179gm4d0qwb6wv";
authors = [
"Sergio Benitez <sb@sergio.bz>"
];
buildDependencies = [
{
name = "version_check";
packageId = "version_check";
}
];
features = {
"default" = [ "alloc" ];
"serde" = [ "dep:serde" ];
"with-serde" = [ "serde" ];
"with-serde-alloc" = [ "serde" "serde/alloc" "alloc" ];
};
};
"unic-langid" = rec {
crateName = "unic-langid";
version = "0.9.1";

View File

@ -458,51 +458,33 @@ mod tests {
#[test]
fn it_expresses_day_of_week() {
assert_eq!(IFC::leap_day(12020).unwrap().weekday(), DayOfWeek::LeapDay);
assert_eq!(IFC::year_day(12022).weekday(), DayOfWeek::YearDay);
assert_eq!(IFC::ymd(12022, 1, 1).unwrap().weekday(), DayOfWeek::Sunday);
assert_eq!(IFC::ymd(12022, 1, 2).unwrap().weekday(), DayOfWeek::Monday);
assert_eq!(IFC::ymd(12022, 1, 3).unwrap().weekday(), DayOfWeek::Tuesday);
assert_eq!(
IFC::leap_day(12020).unwrap().weekday_ifc(),
DayOfWeek::LeapDay
);
assert_eq!(IFC::year_day(12022).weekday_ifc(), DayOfWeek::YearDay);
assert_eq!(
IFC::ymd(12022, 1, 1).unwrap().weekday_ifc(),
DayOfWeek::Sunday
);
assert_eq!(
IFC::ymd(12022, 1, 2).unwrap().weekday_ifc(),
DayOfWeek::Monday
);
assert_eq!(
IFC::ymd(12022, 1, 3).unwrap().weekday_ifc(),
DayOfWeek::Tuesday
);
assert_eq!(
IFC::ymd(12022, 1, 4).unwrap().weekday_ifc(),
IFC::ymd(12022, 1, 4).unwrap().weekday(),
DayOfWeek::Wednesday
);
assert_eq!(
IFC::ymd(12022, 1, 5).unwrap().weekday_ifc(),
IFC::ymd(12022, 1, 5).unwrap().weekday(),
DayOfWeek::Thursday
);
assert_eq!(IFC::ymd(12022, 1, 6).unwrap().weekday(), DayOfWeek::Friday);
assert_eq!(
IFC::ymd(12022, 1, 6).unwrap().weekday_ifc(),
DayOfWeek::Friday
);
assert_eq!(
IFC::ymd(12022, 1, 7).unwrap().weekday_ifc(),
IFC::ymd(12022, 1, 7).unwrap().weekday(),
DayOfWeek::Saturday
);
assert_eq!(
IFC::ymd(12022, 1, 8).unwrap().weekday_ifc(),
DayOfWeek::Sunday
);
assert_eq!(IFC::ymd(12022, 1, 8).unwrap().weekday(), DayOfWeek::Sunday);
}
#[test]
fn it_expresses_month() {
assert_eq!(IFC::ymd(12022, 1, 4).unwrap().month_ifc(), Month::January);
assert_eq!(IFC::ymd(12022, 12, 1).unwrap().month_ifc(), Month::November);
assert_eq!(IFC::leap_day(12020).unwrap().month_ifc(), Month::June);
assert_eq!(IFC::year_day(12020).month_ifc(), Month::December);
assert_eq!(IFC::ymd(12022, 1, 4).unwrap().month(), Month::January);
assert_eq!(IFC::ymd(12022, 12, 1).unwrap().month(), Month::November);
assert_eq!(IFC::leap_day(12020).unwrap().month(), Month::June);
assert_eq!(IFC::year_day(12020).month(), Month::December);
}
#[test]