MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / test_parse_timezone_offset_second

Function test_parse_timezone_offset_second

src/pgtz/src/timezone.rs:412–511  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

410
411 #[mz_ore::test]
412 fn test_parse_timezone_offset_second() {
413 use Timezone::{FixedOffset as F, Tz as T};
414 let test_cases = [
415 ("+0:00", F(FixedOffset::east_opt(0).unwrap())),
416 ("-0:00", F(FixedOffset::east_opt(0).unwrap())),
417 ("+0:000000", F(FixedOffset::east_opt(0).unwrap())),
418 ("+000000:00", F(FixedOffset::east_opt(0).unwrap())),
419 ("+000000:000000", F(FixedOffset::east_opt(0).unwrap())),
420 ("+0", F(FixedOffset::east_opt(0).unwrap())),
421 ("+00", F(FixedOffset::east_opt(0).unwrap())),
422 ("+000", F(FixedOffset::east_opt(0).unwrap())),
423 ("+0000", F(FixedOffset::east_opt(0).unwrap())),
424 ("+00000000", F(FixedOffset::east_opt(0).unwrap())),
425 ("+0000001:000000", F(FixedOffset::east_opt(3600).unwrap())),
426 ("+0000000:000001", F(FixedOffset::east_opt(60).unwrap())),
427 ("+0000001:000001", F(FixedOffset::east_opt(3660).unwrap())),
428 (
429 "+0000001:000001:000001",
430 F(FixedOffset::east_opt(3661).unwrap()),
431 ),
432 ("+4:00", F(FixedOffset::east_opt(14400).unwrap())),
433 ("-4:00", F(FixedOffset::west_opt(14400).unwrap())),
434 ("+2:30", F(FixedOffset::east_opt(9000).unwrap())),
435 ("-5:15", F(FixedOffset::west_opt(18900).unwrap())),
436 ("+0:20", F(FixedOffset::east_opt(1200).unwrap())),
437 ("-0:20", F(FixedOffset::west_opt(1200).unwrap())),
438 ("+0:0:20", F(FixedOffset::east_opt(20).unwrap())),
439 ("+5", F(FixedOffset::east_opt(18000).unwrap())),
440 ("-5", F(FixedOffset::west_opt(18000).unwrap())),
441 ("+05", F(FixedOffset::east_opt(18000).unwrap())),
442 ("-05", F(FixedOffset::west_opt(18000).unwrap())),
443 ("+500", F(FixedOffset::east_opt(18000).unwrap())),
444 ("-500", F(FixedOffset::west_opt(18000).unwrap())),
445 ("+530", F(FixedOffset::east_opt(19800).unwrap())),
446 ("-530", F(FixedOffset::west_opt(19800).unwrap())),
447 ("+050", F(FixedOffset::east_opt(3000).unwrap())),
448 ("-050", F(FixedOffset::west_opt(3000).unwrap())),
449 ("+15", F(FixedOffset::east_opt(54000).unwrap())),
450 ("-15", F(FixedOffset::west_opt(54000).unwrap())),
451 ("+1515", F(FixedOffset::east_opt(54900).unwrap())),
452 ("+15:15:15", F(FixedOffset::east_opt(54915).unwrap())),
453 ("+015", F(FixedOffset::east_opt(900).unwrap())),
454 ("-015", F(FixedOffset::west_opt(900).unwrap())),
455 ("+0015", F(FixedOffset::east_opt(900).unwrap())),
456 ("-0015", F(FixedOffset::west_opt(900).unwrap())),
457 ("+00015", F(FixedOffset::east_opt(900).unwrap())),
458 ("-00015", F(FixedOffset::west_opt(900).unwrap())),
459 ("+005", F(FixedOffset::east_opt(300).unwrap())),
460 ("-005", F(FixedOffset::west_opt(300).unwrap())),
461 ("+0000005", F(FixedOffset::east_opt(300).unwrap())),
462 ("+00000100", F(FixedOffset::east_opt(3600).unwrap())),
463 ("Z", F(FixedOffset::east_opt(0).unwrap())),
464 ("z", F(FixedOffset::east_opt(0).unwrap())),
465 ("UTC", F(FixedOffset::east_opt(0).unwrap())),
466 ("Pacific/Auckland", T(Tz::Pacific__Auckland)),
467 ("America/New_York", T(Tz::America__New_York)),
468 ("America/Los_Angeles", T(Tz::America__Los_Angeles)),
469 ("utc", F(FixedOffset::east_opt(0).unwrap())),

Callers

nothing calls this directly

Calls 3

unwrapMethod · 0.80
parseFunction · 0.50
iterMethod · 0.45

Tested by

no test coverage detected