<commit_before>#!perl

use strict;
use warnings;

use Test::More;

use DateTime           qw( );
use DateTime::TimeZone qw( );
use DateTimeX::Start   qw( :ALL );


sub dt {
   return
      DateTime->new(
         year   => $_[0],
         month  => $_[1],
         day    => $_[2],
         hour   => $_[3] || 0,
         minute => $_[4] || 0,
         second => $_[5] || 0,
         time_zone => $_[6] || 'UTC',
      );
}


{
   my @tests = (
      [ 'An ordinary day',          '0.18', sub { start_of_date([ 2014,  2,  3 ], 'America/Toronto'  ) }, sub { dt(2014,  2,  3, 5, 0, 0)->set_time_zone('America/Toronto'  ) } ],
      [ 'A day without midnight',   '0.26', sub { start_of_date([ 2013, 10, 20 ], 'America/Sao_Paulo') }, sub { dt(2013, 10, 20, 3, 0, 0)->set_time_zone('America/Sao_Paulo') } ],
      [ 'A day with two midnights', '1.53', sub { start_of_date([ 2013, 11,  3 ], 'America/Havana'   ) }, sub { dt(2013, 11,  3, 4, 0, 0)->set_time_zone('America/Havana'   ) } ],
   );

   plan tests => 0+@tests;

   for my $test (@tests) {
      SKIP: {
         my ($name, $min_ver, $test_code, $expected_code) = @$test;

         skip("DateTime::TimeZone $min_ver required", 1)
            if $DateTime::TimeZone::VERSION < $min_ver;

         my $got_dt = eval { $test_code->() };
         if (!$got_dt) {
            my $e = $@;
            fail($name)
               or diag("Got exception executing test: $@");<commit_msg>Add TODO tests for bug RT#118417<commit_after>#!perl

use strict;
use warnings;

use Test::More;

use DateTime           qw( );
use DateTime::TimeZone qw( );
use DateTimeX::Start   qw( :ALL );


sub dt {
   return
      DateTime->new(
         year   => $_[0],
         month  => $_[1],
         day    => $_[2],
         hour   => $_[3] || 0,
         minute => $_[4] || 0,
         second => $_[5] || 0,
         time_zone => $_[6] || 'UTC',
      );
}


{
   my @tests = (
      [ 'An ordinary day',                         '0.18', undef,       sub { start_of_date( [ 2014,  2,  3 ], 'America/Toronto'         ) }, sub { dt(2014,  2,  3,  5, 0, 0)->set_time_zone('America/Toronto'  ) } ],
      [ 'A day without midnight',                  '0.26', undef,       sub { start_of_date( [ 2013, 10, 20 ], 'America/Sao_Paulo'       ) }, sub { dt(2013, 10, 20,  3, 0, 0)->set_time_zone('America/Sao_Paulo') } ],
      [ 'A day with two midnights',                '1.53', undef,       sub { start_of_date( [ 2013, 11,  3 ], 'America/Havana'          ) }, sub { dt(2013, 11,  3,  4, 0, 0)->set_time_zone('America/Havana'   ) } ],

      [ 'Result is 24 hours earlier [RT#118417]',  '0',    "RT#118417", sub { start_of_date( dt(2016, 10, 30, 23,  0, 0, 'Europe/Paris') ) }, sub { dt(2016, 10, 29, 22, 0, 0)->set_time_zone('Europe/Paris'       ) } ],
      [ 'Result is >24 hours earlier [RT#118417]', '0',    "RT#118417", sub { start_of_date( dt(2016, 10, 30, 23, 30, 0, 'Europe/Paris') ) }, sub { dt(2016, 10, 29, 22, 0, 0)->set_time_zone('Europe/Paris'       ) } ],
   );

   plan tests => 0+@tests;

   for my $test (@tests) {
      SKIP: {
         my ($name, $min_ver, $todo, $test_code, $expected_code) = @$test;

         skip("DateTime::TimeZone $min_ver required", 1)
            if $DateTime::TimeZone::VERSION lt $min_ver;

         local $TODO = $todo;

         my $got_dt = eval { $test_code->() };
         if (!$got_dt) {
            my $e = $@;
            fail($name)
               or diag("Got exception executing test: $@");
{'fraction_non_alphanumeric': 0.19077809798270892, 'fraction_numerical': 0.0659942363112392, 'mean_word_length': 2.074402125775022, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 32, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4349499', 'n_tokens_mistral': 1456, 'n_tokens_neox': 1261, 'n_words': 321}