Skip to content

Commit

Permalink
[tests] add test case for unit parsing fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Vindaar committed Mar 27, 2024
1 parent 848a8eb commit c7a4002
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/tunchained.nim
Original file line number Diff line number Diff line change
Expand Up @@ -1162,6 +1162,18 @@ suite "Quantity concepts":
else:
check true

test "Verify invalid prefixes are not allowed":
## Ref: issue #48
let val = 100.Foot
when compiles(val.toMeter()):
check false
when compiles(val.toKiloGram()):
check false
when compiles(val.foobarMeter()):
check false
when compiles(val.tMeter()):
check false

suite "Unchained - math with typedescs to define units":
test "Pure typedesc math defines units":
block:
Expand Down Expand Up @@ -1225,6 +1237,8 @@ suite "Unchained - math with typedescs to define units":
let x = 1.kg * 1.m^2 * s^(-1)
check x == 1.kg•m²•s⁻¹



#converter to_eV(x: GeV): eV =
# echo "toEv!"
# (x.float * 1e-9).eV
Expand Down

0 comments on commit c7a4002

Please sign in to comment.