| 1 | #!/usr/bin/perl |
| 2 | |
| 3 | use warnings; |
| 4 | use strict; |
| 5 | use Test::Inter; |
| 6 | $::ti = new Test::Inter $0; |
| 7 | require "tests.pl"; |
| 8 | |
| 9 | our $obj = new Date::Manip::TZ; |
| 10 | $obj->config("forcedate","now,America/New_York"); |
| 11 | |
| 12 | sub test { |
| 13 | my(@test)=@_; |
| 14 | return $obj->zone(@test); |
| 15 | } |
| 16 | |
| 17 | my $tests=" |
| 18 | |
| 19 | # |
| 20 | # Zone only tests |
| 21 | # |
| 22 | |
| 23 | America/New_York => America/New_York |
| 24 | |
| 25 | AAAmerica/New_York => __undef__ |
| 26 | |
| 27 | america/new_york => America/New_York |
| 28 | |
| 29 | est5edt => America/New_York |
| 30 | |
| 31 | us/eastern => America/New_York |
| 32 | |
| 33 | # |
| 34 | # Abbrev only tests |
| 35 | # |
| 36 | |
| 37 | ywt => |
| 38 | America/Whitehorse |
| 39 | America/Dawson |
| 40 | America/Yakutat |
| 41 | |
| 42 | # |
| 43 | # Offset tests |
| 44 | # |
| 45 | |
| 46 | +06:30:00 stdonly => |
| 47 | Asia/Yangon |
| 48 | Asia/Colombo |
| 49 | Asia/Dhaka |
| 50 | |
| 51 | +06:30:00 dstonly => |
| 52 | Asia/Kolkata |
| 53 | Asia/Colombo |
| 54 | Asia/Karachi |
| 55 | |
| 56 | +06:30:00 std => |
| 57 | Asia/Yangon |
| 58 | Asia/Colombo |
| 59 | Asia/Dhaka |
| 60 | Asia/Kolkata |
| 61 | Asia/Karachi |
| 62 | |
| 63 | +06:30:00 dst => |
| 64 | Asia/Kolkata |
| 65 | Asia/Colombo |
| 66 | Asia/Karachi |
| 67 | Asia/Yangon |
| 68 | Asia/Dhaka |
| 69 | |
| 70 | # |
| 71 | # Abbrev/offset tests |
| 72 | # |
| 73 | |
| 74 | -05:00:00 EDT => |
| 75 | |
| 76 | BST => |
| 77 | Europe/London |
| 78 | America/Adak |
| 79 | America/Nome |
| 80 | Europe/Gibraltar |
| 81 | America/La_Paz |
| 82 | Europe/Dublin |
| 83 | Atlantic/Bermuda |
| 84 | |
| 85 | +01:00:00 BST => |
| 86 | Europe/London |
| 87 | Europe/Gibraltar |
| 88 | Europe/Dublin |
| 89 | |
| 90 | -11:00:00 BST => |
| 91 | America/Adak |
| 92 | America/Nome |
| 93 | |
| 94 | # |
| 95 | # Mixed data |
| 96 | # |
| 97 | |
| 98 | => |
| 99 | America/New_York |
| 100 | |
| 101 | std |
| 102 | => |
| 103 | America/New_York |
| 104 | |
| 105 | dstonly |
| 106 | => |
| 107 | America/New_York |
| 108 | |
| 109 | -2 |
| 110 | stdonly |
| 111 | => |
| 112 | Atlantic/South_Georgia |
| 113 | America/Noronha |
| 114 | America/Scoresbysund |
| 115 | America/Nuuk |
| 116 | Etc/GMT-2 |
| 117 | B |
| 118 | Atlantic/Cape_Verde |
| 119 | Atlantic/Azores |
| 120 | |
| 121 | -02:00 |
| 122 | stdonly |
| 123 | => |
| 124 | Atlantic/South_Georgia |
| 125 | America/Noronha |
| 126 | America/Scoresbysund |
| 127 | America/Nuuk |
| 128 | Etc/GMT-2 |
| 129 | B |
| 130 | Atlantic/Cape_Verde |
| 131 | Atlantic/Azores |
| 132 | |
| 133 | [ 2001 01 01 00 00 00 ] => America/New_York |
| 134 | |
| 135 | [ 2001 01 01 00 00 00 ] ABC => __undef__ |
| 136 | |
| 137 | [ 2001 01 01 00 00 00 ] 9:50:0x => __undef__ |
| 138 | |
| 139 | [ 2001 01 01 00 00 00 ] 9:50:00 => __undef__ |
| 140 | |
| 141 | [ 2001 01 01 00 00 00 ] -12:00:00 dstonly => |
| 142 | |
| 143 | [ 1980 01 01 00 00 00 ] +07:30:00 => Asia/Singapore |
| 144 | |
| 145 | # |
| 146 | # HPUX zones |
| 147 | # |
| 148 | |
| 149 | BRST3BRDT => America/Sao_Paulo |
| 150 | |
| 151 | 'EST5EDT#Canada' => America/Toronto |
| 152 | |
| 153 | "; |
| 154 | |
| 155 | $::ti->tests(func => \&test, |
| 156 | tests => $tests); |
| 157 | $::ti->done_testing(); |
| 158 | |
| 159 | #Local Variables: |
| 160 | #mode: cperl |
| 161 | #indent-tabs-mode: nil |
| 162 | #cperl-indent-level: 3 |
| 163 | #cperl-continued-statement-offset: 2 |
| 164 | #cperl-continued-brace-offset: 0 |
| 165 | #cperl-brace-offset: 0 |
| 166 | #cperl-brace-imaginary-offset: 0 |
| 167 | #cperl-label-offset: 0 |
| 168 | #End: |