diff --git a/.appveyor.yml b/.appveyor.yml index 9565327..95e35df 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,9 +1,7 @@ # Documentation: https://github.com/JuliaCI/Appveyor.jl environment: matrix: - - julia_version: 1.3.0 - - julia_version: 1.4.2 - - julia_version: nightly + - julia_version: 1.6.0 repo_token: secure: locJtjEVIkbzBA/+67vXJHOupVRB1TqocLm8QFGSjCRPIpOVaJcvTLnxTnUY+Lvu platform: @@ -11,7 +9,7 @@ platform: - x64 matrix: allow_failures: - - julia_version: nightly + - julia_version: 1.6.0 branches: only: - master @@ -24,6 +22,7 @@ notifications: install: - ps: iex ((new-object net.webclient).DownloadString("https://raw.githubusercontent.com/JuliaCI/Appveyor.jl/version-1/bin/install.ps1")) build_script: + - C:\julia\bin\julia -e "Pkg.registry" - echo "%JL_BUILD_SCRIPT%" - C:\julia\bin\julia -e "%JL_BUILD_SCRIPT%" test_script: diff --git a/Manifest.toml b/Manifest.toml deleted file mode 100644 index 94d8a1e..0000000 --- a/Manifest.toml +++ /dev/null @@ -1,52 +0,0 @@ -# This file is machine-generated - editing it directly is not advised - -[[Base64]] -uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" - -[[ConstructionBase]] -deps = ["LinearAlgebra"] -git-tree-sha1 = "48920211c95a6da1914a06c44ec94be70e84ffff" -uuid = "187b0558-2788-49d3-abe0-74a17ed4e7c9" -version = "1.1.0" - -[[Distributed]] -deps = ["Random", "Serialization", "Sockets"] -uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b" - -[[InteractiveUtils]] -deps = ["Markdown"] -uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240" - -[[Libdl]] -uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb" - -[[LinearAlgebra]] -deps = ["Libdl"] -uuid = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" - -[[Logging]] -uuid = "56ddb016-857b-54e1-b83d-db4d58db5568" - -[[Markdown]] -deps = ["Base64"] -uuid = "d6f4376e-aef5-505a-96c1-9c027394607a" - -[[Random]] -deps = ["Serialization"] -uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" - -[[Serialization]] -uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b" - -[[Sockets]] -uuid = "6462fe0b-24de-5631-8697-dd941f90decc" - -[[Test]] -deps = ["InteractiveUtils", "Logging", "Random", "Serialization"] -uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40" - -[[Unitfu]] -deps = ["ConstructionBase", "LinearAlgebra", "Random"] -git-tree-sha1 = "5b07a0ed91dc5b9ca192d4562a6efd4c94470b9c" -uuid = "5ee08b94-2369-4f4a-b8c7-99333ba35fb0" -version = "0.18.0" diff --git a/Project.toml b/Project.toml index b321eec..d44bbe8 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "MechanicalUnits" uuid = "e6be9192-89dc-11e9-36e6-5dbcb28f419e" authors = ["hustf <hustf@users.noreply.github.com>"] -version = "0.4.3" +version = "0.4.4" [deps] Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" diff --git a/README.md b/README.md index 6163c66..4fc559d 100644 --- a/README.md +++ b/README.md @@ -34,21 +34,21 @@ Benefits to using quantities rather than just numbers: | Units | (Derived) dimension | Dimensions | | ------------- | ------------- | ------------- | | nm μm μm mm cm dm m km Mm Gm Tm Pm inch ft | Length | ᴸ | -| ns μs μs ms s minute d h yr | Time | ᵀ | +| ns μs μs ms s minute d h yr | Time | ᵀ | | mg cg kg lb shton | Mass | ᴹ | | K Ra °C °F | Temperature | ᶿ | -| Angles | NoDims | rad ° | +| Angles | NoDims | rad ° | | N daN kN MN GN lbf kip | Force | ᴸ∙ ᴹ ∙ ᵀ⁻² | | Pa kPa MPa GPa atm bar | Pressure | ᴹ ∙ ᴸ⁻¹ ∙ ᵀ⁻² | -| J kJ MJ GJ | Energy | ᴸ² ∙ ᴹ ∙ ᵀ⁻² | -| Nmm Nm daNm kNm MNm GNm | Moment | ᴸ² ∙ ᴹ ∙ ᵀ⁻² | -| l dl cl ml | Volume | ᴸ³ | -| g | Acceleration | ᴸ ∙ ᵀ⁻² | +| J kJ MJ GJ | Energy | ᴸ² ∙ ᴹ ∙ ᵀ⁻² | +| Nmm Nm daNm kNm MNm GNm | Moment | ᴸ² ∙ ᴹ ∙ ᵀ⁻² | +| l dl cl ml | Volume | ᴸ³ | +| g | Acceleration | ᴸ ∙ ᵀ⁻² | ## Dimensions -Dimensions are useful for defining specialized functions, e.g. `plot(F::Force)`. +Dimensions are useful for defining specialized functions, e.g. `plot(F::Force)`. -| Derived dimension | Dimensions | +| Derived dimension | Dimensions | | ------------- | ------------- | | Area | ᴸ² | | Velocity | ᴸ / ᵀ | @@ -62,6 +62,7 @@ We avoid defining common and ambigious derived dimensions. For example, the deri ## Usage ### Installation +We appreciate 'Unitful.jl', but do need some specific syntax. To avoid conflict, Unitfu.jl and this package is registered in a separate registry, which holds related packages for solving, plotting, sketching and latex with units. ´´´ pkg> registry add https://github.com/hustf/M8 @@ -72,14 +73,14 @@ pkg> registry add MechanicalUnits ### Example REPL workflow -Let us do some side calculations (other examples in that folder): +Let us do some quick side calculations (code in `/examples`): ```julia julia> using MechanicalUnits julia> m_air = 1000kg; c_p = 1.00kJ/(kg*K) 1.0kJ∙kg⁻¹∙K⁻¹ -julia> @import_expand ~W # Watt = Joule / Second is not exported by default. +julia> @import_expand ~W # Watt = Joule / Second is not exported by default. Several: (u1, u2,..) julia> Q_cp(T1, T2) = m_air*c_p*(T2-T1) |> (kW*h) Q_cp (generic function with 1 method) @@ -93,14 +94,15 @@ mm julia> preferunits(m) julia> m_s = [30kg/m 28.8lb/ft] -1×2 Array{Float64{kg∙m⁻¹},2}: +1×2 Matrix{Quantity{Float64, ᴹ∙ ᴸ⁻¹, FreeUnits{(kg, m⁻¹), ᴹ∙ ᴸ⁻¹, nothing}}}: 30.0 42.8591 julia> l_s = 93ft*[3 4]m/s -372ft +1×2 Matrix{Quantity{Int64, ᴸ²∙ ᵀ⁻¹, FreeUnits{(ft, m, s⁻¹), ᴸ²∙ ᵀ⁻¹, nothing}}}: + 279 372 julia> m_s.*l_s |> (kg*m) -1×2 Array{Float64{kg∙m∙s⁻¹},2}: +1×2 Matrix{Quantity{Float64, ᴸ∙ ᴹ∙ ᵀ⁻¹, FreeUnits{(kg, m, s⁻¹), ᴸ∙ ᴹ∙ ᵀ⁻¹, nothing}}}: 2551.18 4859.61 julia> E=206GPa; h_y = 100mm; b = 30mm; I = 1/12 * b * h_y^3 @@ -113,33 +115,32 @@ julia> F*L^3/(3E*I) |> mm 5.0778770226537215mm julia> l_wire = 20m +20m julia> k(d) = E * 0.691 * π/4 * d^2 / l_wire |> N/mm k (generic function with 1 method) julia> k.([5 6 8]mm) -1×3 Array{Float64{N∙mm⁻¹},2}: +1×3 Matrix{Quantity{Float64, ᴹ∙ ᵀ⁻², FreeUnits{(mm⁻¹, N), ᴹ∙ ᵀ⁻², nothing}}}: 139.748 201.237 357.755 julia> δ(d)= F / k(d) |> mm δ (generic function with 1 method) julia> δ.([5, 6, 8]mm) -3-element Array{Float64{mm},1}: +3-element Vector{Quantity{Float64, ᴸ, FreeUnits{(mm,), ᴸ, nothing}}}: 7.017388381199098 4.873186375832707 2.7411673364058977 julia> d = 6mm -ERROR: cannot assign variable Unitfu.d from module Main -Stacktrace: - [1] top-level scope at none:0 +6mm julia> dimension(d) - ᵀ + ᴸ julia> 1d |> s -(86400//1)s +(3//500)m julia> @import_expand ~V ~W ~A G @@ -147,54 +148,168 @@ julia> sqrt(1G²) 6.6743e-11m³∙kg⁻¹∙s⁻² julia> [1V*12.0A 2W 1kg*g*1m/2s]*30minute |> kJ -1×3 Array{Float64{kJ},2}: +1×3 Matrix{Quantity{Float64, ᴸ²∙ ᴹ∙ ᵀ⁻², FreeUnits{(kJ,), ᴸ²∙ ᴹ∙ ᵀ⁻², nothing}}}: 21.6 3.6 8.82598 julia> ω = 50*2π*rad/s -π = 3.1415926535897...rad∙s⁻¹ +314.1592653589793rad∙s⁻¹ julia> t = (0:0.006:0.02)s -0.0s:0.006s:0.018s +(0.0:0.006:0.018)s julia> u = 220V*exp.(im∙(ω∙t)) -4-element Array{Complex{Float64}{V},1}: +4-element Vector{Quantity{ComplexF64, ᴸ²∙ ᴹ∙ ᴵ⁻¹∙ ᵀ⁻³, FreeUnits{(V,), ᴸ²∙ ᴹ∙ ᴵ⁻¹∙ ᵀ⁻³, nothing}}}: + 220.0 + 0.0im + -67.98373876248841 + 209.2324335849338im + -177.98373876248843 - 129.31275550434407im + 177.98373876248843 - 129.31275550434412im + +julia> typeof(dyn) +FreeUnits{(dyn,), ᴸ∙ ᴹ∙ ᵀ⁻², nothing} ), ᴸ²∙ ᴹ∙ ᵀ⁻³, nothing}}}: + y default +julia> 1dyn |> μm +10kg∙μm∙s⁻² + +julia> + +julia> +julia> lin = "2 [s]\t11364.56982421875 [N]\t-44553.50244140625 [N]\t-26.586366176605225 [N]\t0.0[N mm]\t0.0[N mm]" +"2 [s]\t11364.56982421875 [N]\t-44553.50244140625 [N]\t-26.586366176605225 [N]\t0.0[N mm]\t0.0[N mm]" +julia> strinp = "2 [s]\t11364.56982421875 [N]\t-44553.50240625 [N]\t4140625 [N]\t-26.586366176605225 [N]\t0.0[N mm]\t0.0[N mm]" .586366176 +"2 [s]\t11364.56982421875 [N]\t-44553.50244140625 [N]\t-26.586366176605225 [N]\t0.0[N mm]\t0.0[N mm]" 4140625 [N + +julia> .586366176 + +julia> + +julia> time, Fx, Fy, Fz, Mx, My, Mz, px, py, pz = parse.(Quantity{Float64}, split(lin, '\t')) +ERROR: BoundsError: attempt to access 6-element Vector{Quantity{Float64, D, U} where {D, U}} at index [7]StacktraFloat64, D, U} where {D, U}} at index [7]Stacktrace: + [1] getindex + @ .\array.jl:801 [inlined] + [2] indexed_iterate(a::Vector{Quantity{Float64, D, U} where {D, U}}, i::Int64, state::Int64) U}}, i::Int64, state::Int64) + @ Base .\tuple.jl:87 + [3] top-level scope + @ REPL[38]:1 + , '\t'))index [7]Stacktrajulia> using MechanicalUnits + +julia> m_air = 1000kg; c_p = 1.00kJ/(kg*K) +1.0kJ∙kg⁻¹∙K⁻¹ + +julia> @import_expand ~W # Watt = Joule / Second is not exported by default. Several: (u1, u2,..) + +julia> Q_cp(T1, T2) = m_air*c_p*(T2-T1) |> (kW*h) +Q_cp (generic function with 1 method) + +julia> Q_cp(20°C, 985°C) +268.05555555555554kW∙h + +julia> dm |> upreferred +mm + +julia> preferunits(m) + +julia> m_s = [30kg/m 28.8lb/ft] +1×2 Matrix{Quantity{Float64, ᴹ∙ ᴸ⁻¹, FreeUnits{(kg, m⁻¹), ᴹ∙ ᴸ⁻¹, nothing}}}: + 30.0 42.8591 + +julia> l_s = 93ft*[3 4]m/s +1×2 Matrix{Quantity{Int64, ᴸ²∙ ᵀ⁻¹, FreeUnits{(ft, m, s⁻¹), ᴸ²∙ ᵀ⁻¹, nothing}}}: + 279 372 + +julia> m_s.*l_s |> (kg*m) +1×2 Matrix{Quantity{Float64, ᴸ∙ ᴹ∙ ᵀ⁻¹, FreeUnits{(kg, m, s⁻¹), ᴸ∙ ᴹ∙ ᵀ⁻¹, nothing}}}: + 2551.18 4859.61 + +julia> E=206GPa; h_y = 100mm; b = 30mm; I = 1/12 * b * h_y^3 +2.5e6mm⁴ + +julia> L = 2m; F=100kg*g |> N +980.665N + +julia> F*L^3/(3E*I) |> mm +5.0778770226537215mm + +julia> l_wire = 20m +20m + +julia> k(d) = E * 0.691 * π/4 * d^2 / l_wire |> N/mm +k (generic function with 1 method) + +julia> k.([5 6 8]mm) +1×3 Matrix{Quantity{Float64, ᴹ∙ ᵀ⁻², FreeUnits{(mm⁻¹, N), ᴹ∙ ᵀ⁻², nothing}}}: + 139.748 201.237 357.755 + +julia> δ(d)= F / k(d) |> mm +δ (generic function with 1 method) + +julia> δ.([5, 6, 8]mm) +3-element Vector{Quantity{Float64, ᴸ, FreeUnits{(mm,), ᴸ, nothing}}}: + 7.017388381199098 + 4.873186375832707 + 2.7411673364058977 + +julia> d = 6mm +6mm + +julia> dimension(d) + ᴸ + +julia> 1d |> s +(3//500)m + +julia> @import_expand ~V ~W ~A G + +julia> sqrt(1G²) +6.6743e-11m³∙kg⁻¹∙s⁻² + +julia> [1V*12.0A 2W 1kg*g*1m/2s]*30minute |> kJ +1×3 Matrix{Quantity{Float64, ᴸ²∙ ᴹ∙ ᵀ⁻², FreeUnits{(kJ,), ᴸ²∙ ᴹ∙ ᵀ⁻², nothing}}}: + 21.6 3.6 8.82598 + +julia> ω = 50*2π*rad/s +314.1592653589793rad∙s⁻¹ + +julia> t = (0:0.006:0.02)s +(0.0:0.006:0.018)s + +julia> u = 220V*exp.(im∙(ω∙t)) +4-element Vector{Quantity{ComplexF64, ᴸ²∙ ᴹ∙ ᴵ⁻¹∙ ᵀ⁻³, FreeUnits{(V,), ᴸ²∙ ᴹ∙ ᴵ⁻¹∙ ᵀ⁻³, nothing}}}: 220.0 + 0.0im -67.98373876248841 + 209.2324335849338im -177.98373876248843 - 129.31275550434407im 177.98373876248843 - 129.31275550434412im julia> u*1.5A |> J -4-element Array{Complex{Float64}{J∙s⁻¹},1}: +4-element Vector{Quantity{ComplexF64, ᴸ²∙ ᴹ∙ ᵀ⁻³, FreeUnits{(J, s⁻¹), ᴸ²∙ ᴹ∙ ᵀ⁻³, nothing}}}: 330.0 + 0.0im -101.97560814373261 + 313.8486503774007im -266.97560814373264 - 193.9691332565161im 266.97560814373264 - 193.9691332565162im ``` -### Adding or removing units -If you want fewer globally defined variables, @import_expand just what you need: +### Importing fewer units, or other units +If you want fewer globally defined variables, @import_expand just what you need: ```julia -julia> import MechanicalUnits: @import_expand, ∙ - -julia> @import_expand ~m # ~ : also import SI prefixes +julia> @import_expand(~m, dyn) # ~ : also import SI prefixes for metre julia> (1.0cm², 2.0mm∙m, 3.0dm⁴/m² ) .|> mm² (100.0, 2000.0, 300.0)mm² -julia> @import_expand dyn # This unit is not exported by default - julia> typeof(dyn) -Unitfu.FreeUnits{(dyn,), ᴸ∙ ᴹ∙ ᵀ⁻²,nothing} +FreeUnits{(dyn,), ᴸ∙ ᴹ∙ ᵀ⁻², nothing} julia> 1dyn |> μm 10kg∙μm∙s⁻² -julia> # When parsing text file, spaces as multipliers and brackets are allowed. Just specify the numeric type: -julia> lin = "2 [s]\t11364.56982421875 [N]\t-44553.50244140625 [N]\t-26.586366176605225 [N]\t0.0[N mm]\t0.0[N mm]\t0.0[N mm]\t1561.00350618362 [mm]\t-6072.3729133606 [mm]\t2825.15907287598 [mm]" -"2 [s]\t11364.56982421875 [N]\t-44553.50244140625 [N]\t-26.586366176605225 [N]\t0.0[N mm]\t0.0[N mm]\t0.0[N mm]\t1561.00350618362 [mm]\t-6072.3729133606 [mm]\t2825.15907287598 [mm]" +``` -julia> time, Fx, Fy, Fz, Mx, My, Mz, px, py, pz = parse.(Quantity{Float64}, split(lin, '\t')) -10-element Array{Quantity{Float64,D,U} where U where D,1}: +When parsing a text file, typically from some other software, spaces as multipliers and brackets are allowed. Tabs are also accepted. But you need to specify the numeric type of output quantities, like this: + +```julia +julia> strinp = "2 [s]\t11364.56982421875 [N]\t-44553.50244140625 [N]\t-26.586366176605225 [N]\t0.0[N mm]\t0.0[N mm]\t0.0[N mm]\t1561.00350618362 [mm]\t-6072.3729133606 [mm]\t2825.15907287598 [mm]"; + +julia> time, Fx, Fy, Fz, Mx, My, Mz, px, py, pz = parse.(Quantity{Float64}, split(strinp, '\t')) +10-element Vector{Quantity{Float64, D, U} where {D, U}}: 2.0s 11364.56982421875N -44553.50244140625N @@ -239,7 +354,7 @@ See [Unitful.jl](https://github.com/PainterQubits/Unitful.jl) - Open an [issue](https://github.com/hustf/MechanicalUnits/issues/new) and let's make this better together! -- *Bug reports, feature requests, patches, and well-wishes are always welcome.* +- *Bug reports, feature requests, patches, and well-wishes are always welcome.* ## Contributing diff --git a/examples/readme_example.jl b/examples/readme_example.jl index d3bbc1b..37c59cd 100644 --- a/examples/readme_example.jl +++ b/examples/readme_example.jl @@ -1,7 +1,8 @@ # Run line by line in the REPL, or ctrl + enter in VSCode +# First code section using MechanicalUnits m_air = 1000kg; c_p = 1.00kJ/(kg*K) -@import_expand ~W # Watt = Joule / Second is not exported by default. +@import_expand ~W # Watt = Joule / Second is not exported by default. Several: (u1, u2,..) Q_cp(T1, T2) = m_air*c_p*(T2-T1) |> (kW*h) Q_cp(20°C, 985°C) dm |> upreferred @@ -27,9 +28,21 @@ sqrt(1G²) t = (0:0.006:0.02)s u = 220V*exp.(im∙(ω∙t)) u*1.5A |> J + +# Second code section import MechanicalUnits: @import_expand, ∙ -@import_expand ~m # ~ : also import SI prefixes +@import_expand(~m, dyn) # ~ : also import SI prefixes for metre (1.0cm², 2.0mm∙m, 3.0dm⁴/m² ) .|> mm² -@import_expand dyn # This unit is not exported by default typeof(dyn) 1dyn |> μm + + + +# Third code section +strinp = "2 [s]\t11364.56982421875 [N]\t-44553.50244140625 [N]\t-26.586366176605225 [N]\t0.0[N mm]\t mm]\t1561.00350610.0[N mm]\t0.0[N mm]\t1561.00350618362 [mm]\t-6072.3729133606 [mm]\t2825.15907287598 [mm]" + + + +strinp = "2 [s]\t11364.56982421875 [N]\t-44553.50244140625 [N]\t-26.586366176605225 [N]\t0.0[N mm]\t0.0[N mm]\t0.0[N mm]\t1561.00350618362 [mm]\t-6072.3729133606 [mm]\t2825.15907287598 [mm]"; + +time, Fx, Fy, Fz, Mx, My, Mz, px, py, pz = parse.(Quantity{Float64}, split(strinp, '\t')) \ No newline at end of file diff --git a/test/pretty-print.jl b/test/pretty-print.jl index f4d3397..36b7cc6 100644 --- a/test/pretty-print.jl +++ b/test/pretty-print.jl @@ -83,9 +83,12 @@ end di in ["⁻⁴" , "⁻³", "⁻²" , "⁻¹", "²", "³", "⁴"] res = shortp(typeof(eval(Symbol(bu*di)))) expec1 = "FreeUnits{(\e[36m" * bu * di* "\e[39m,)," - expec2 = dimdi[eval(Meta.parse(bu)) ] - expec3 = di * ",nothing}" - @test res == expec1*expec2*expec3 + expec2a = "" + expec2b = " " + expec3 = dimdi[eval(Meta.parse(bu)) ] + expec4 = di * ", nothing}" + @test res == expec1*expec2a*expec3*expec4 || + res == expec1*expec2b*expec3*expec4 end end @@ -93,16 +96,19 @@ end a1 = [1 2]m st ="[2 4]\e[36mm\e[39m" @test shortp(2a1) == st - st = "1×2 Array{Quantity{" * sInt * ", ᴸ,FreeUnits{(\e[36mm\e[39m,), ᴸ,nothing}},2}:\n 2 4" + + st = "1×2 Matrix{Quantity{Int64, ᴸ, FreeUnits{(\e[36mm\e[39m,), ᴸ, nothing}}}:\n 2 4" @test longp(2a1) == st + a2 = [1 2]m*s^-1 st = "[2 4]\e[36mm\e[39m∙\e[36ms⁻¹\e[39m" @test shortp(2a2) == st - st = "1×2 Array{Quantity{" * sInt * ", ᴸ∙ ᵀ⁻¹,FreeUnits{(\e[36mm\e[39m, \e[36ms⁻¹\e[39m), ᴸ∙ ᵀ⁻¹,nothing}},2}:\n 2 4" + a3 = [10, 6, 2, -2]m st = "[20, 12, 4, -4]\e[36mm\e[39m" @test shortp(2a3) == st - st = "4-element Array{Quantity{Int64, ᴸ,FreeUnits{(\e[36mm\e[39m,), ᴸ,nothing}},1}:\n 20\n 12\n 4\n -4" + + st = "4-element Vector{Quantity{Int64, ᴸ, FreeUnits{(\e[36mm\e[39m,), ᴸ, nothing}}}:\n 20\n 12\n 4\n -4" @test longp(2a3) == st end @@ -134,14 +140,17 @@ end u = s*m*kg*K @test shortp(u) == "\e[36mkg\e[39m∙\e[36mK\e[39m∙\e[36mm\e[39m∙\e[36ms\e[39m" @test shortp(dimension(u)) == " ᴸ∙ ᴹ∙ ᶿ∙ ᵀ" - @test shortp(typeof(u)) == "FreeUnits{(\e[36mkg\e[39m, \e[36mK\e[39m, \e[36mm\e[39m, \e[36ms\e[39m), ᴸ∙ ᴹ∙ ᶿ∙ ᵀ,nothing}" + st = "FreeUnits{(\e[36mkg\e[39m, \e[36mK\e[39m, \e[36mm\e[39m, \e[36ms\e[39m), ᴸ∙ ᴹ∙ ᶿ∙ ᵀ, nothing}" + @test shortp(typeof(u)) == st + @test shortp(typeof(dimension(u))) == "Dimensions{(Dimension{:Length}(1//1), Dimension{:Mass}(1//1), Dimension{:Temperature}(1//1), Dimension{:Time}(1//1))}" @test shortp(dimension(u^2)) == " ᴸ²∙ ᴹ²∙ ᶿ²∙ ᵀ²" @import_expand A mol v = A * mol @test shortp(v) == "\e[36mA\e[39m∙\e[36mmol\e[39m" @test shortp(dimension(v)) == " ᴺ∙ ᴵ" - @test shortp(typeof(v)) == "FreeUnits{(\e[36mA\e[39m, \e[36mmol\e[39m), ᴺ∙ ᴵ,nothing}" + st = "FreeUnits{(\e[36mA\e[39m, \e[36mmol\e[39m), ᴺ∙ ᴵ, nothing}" + @test shortp(typeof(v)) == st @test shortp(typeof(dimension(v))) == "Dimensions{(Dimension{:Amount}(1//1), Dimension{:Current}(1//1))}" @test shortp(dimension(v^2)) == " ᴺ²∙ ᴵ²" end diff --git a/test/runtests.jl b/test/runtests.jl index e586458..5a42720 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -12,3 +12,4 @@ using Test include("prefixes.jl") end end +nothing \ No newline at end of file