Skip to content

Commit

Permalink
Restructure Numbat integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sharkdp committed Jul 2, 2024
1 parent 303d8b3 commit 83c8507
Show file tree
Hide file tree
Showing 18 changed files with 286 additions and 171 deletions.
170 changes: 0 additions & 170 deletions examples/prelude_tests.nbt

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
let length = 2 m
assert_eq(length, 1 m + 1 m)
assert_eq(1.0 m, 1.001 m, 0.01 m)

assert_eq(2 min + 30 s, 2.5 min, 0.01 s)
22 changes: 22 additions & 0 deletions examples/tests/base_conversion.nbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
assert_eq((0b0 -> bin), "0b0")
assert_eq((0b1 -> bin), "0b1")
assert_eq((0b10 -> bin), "0b10")
assert_eq((0b11 -> bin), "0b11")
assert_eq((0b10101010101010101010101010101010 -> bin), "0b10101010101010101010101010101010")
assert_eq((-0b11110000 -> bin), "-0b11110000")

assert_eq((0o0 -> oct), "0o0")
assert_eq((0o1 -> oct), "0o1")
assert_eq((0o7 -> oct), "0o7")
assert_eq((0o10 -> oct), "0o10")
assert_eq((0o77 -> oct), "0o77")
assert_eq((0o12345670 -> oct), "0o12345670")
assert_eq((-0o12345670 -> oct), "-0o12345670")

assert_eq((0x0 -> hex), "0x0")
assert_eq((0x1 -> hex), "0x1")
assert_eq((0x9 -> hex), "0x9")
assert_eq((0xa -> hex), "0xa")
assert_eq((0xf -> hex), "0xf")
assert_eq((0xabc1234567890 -> hex), "0xabc1234567890")
assert_eq((-0xc0ffee -> hex), "-0xc0ffee")
File renamed without changes.
File renamed without changes.
File renamed without changes.
25 changes: 25 additions & 0 deletions examples/tests/core.nbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# unit_of

assert_eq(unit_of(0), 1)

assert_eq(unit_of(1), 1)
assert_eq(unit_of(1.2345), 1)

assert_eq(unit_of(1 m), m)
assert_eq(unit_of(1.2345 m), m)

assert_eq(unit_of(1 m^2/s), m^2/s)
assert_eq(unit_of(1.2345 m^2/s), m^2/s)

# value_of

assert_eq(value_of(0), 0)

assert_eq(value_of(1), 1)
assert_eq(value_of(1.2345), 1.2345)

assert_eq(value_of(1 m), 1)
assert_eq(value_of(1.2345 m), 1.2345)

assert_eq(value_of(1 m^2/s), 1)
assert_eq(value_of(1.2345 m^2/s), 1.2345)
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 83c8507

Please sign in to comment.