-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This runs a test over all generated tzif files to ensure they contain data convering the expected date range.
- Loading branch information
Showing
4 changed files
with
27 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
defmodule TzdataTest do | ||
use ExUnit.Case, async: true | ||
|
||
@year 365 * 24 * 60 * 60 | ||
@day 24 * 60 * 60 | ||
|
||
# Check that records are available from now until 10 years from now | ||
# The "- 31 * @day" part is to avoid failing on old database builds. | ||
@earliest_record_after NaiveDateTime.utc_now() | ||
@latest_record_after NaiveDateTime.add(NaiveDateTime.utc_now(), 10 * @year - 31 * @day) | ||
|
||
for time_zone <- NervesTimeZones.time_zones() do | ||
test "metadata for #{time_zone}" do | ||
{:ok, meta} = Zoneinfo.get_metadata(unquote(time_zone)) | ||
|
||
# These tests check that records were generated for the requested range | ||
assert NaiveDateTime.compare(@earliest_record_after, meta.earliest_record_utc) == :gt | ||
assert NaiveDateTime.compare(@latest_record_after, meta.latest_record_utc) == :lt | ||
end | ||
end | ||
end |