-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: precompile
@register_unit
in an external module.
- Loading branch information
Showing
4 changed files
with
47 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
module ExternalUnitRegistration | ||
|
||
using DynamicQuantities: @register_unit, @u_str, @us_str, | ||
ALL_MAPPING, ALL_SYMBOLS, DEFAULT_QUANTITY_TYPE, | ||
DEFAULT_SYMBOLIC_QUANTITY_OUTPUT_TYPE, UNIT_SYMBOLS, UNIT_MAPPING | ||
using Test | ||
|
||
@register_unit Wb u"m^2*kg*s^-2*A^-1" | ||
|
||
@testset " Register Unit Inside a Module" begin | ||
for collection in (UNIT_SYMBOLS, ALL_SYMBOLS, keys(ALL_MAPPING._raw_data), keys(UNIT_MAPPING._raw_data)) | ||
@test :Wb ∈ collection | ||
end | ||
|
||
w = u"Wb" | ||
ws = us"Wb" | ||
@test w isa DEFAULT_QUANTITY_TYPE | ||
@test ws isa DEFAULT_SYMBOLIC_QUANTITY_OUTPUT_TYPE | ||
end | ||
|
||
end |
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