summaryrefslogtreecommitdiff
path: root/tests/suite
diff options
context:
space:
mode:
Diffstat (limited to 'tests/suite')
-rw-r--r--tests/suite/foundations/calc.typ96
-rw-r--r--tests/suite/foundations/decimal.typ79
-rw-r--r--tests/suite/foundations/float.typ34
-rw-r--r--tests/suite/foundations/int.typ39
-rw-r--r--tests/suite/foundations/str.typ20
-rw-r--r--tests/suite/scripting/ops.typ55
6 files changed, 289 insertions, 34 deletions
diff --git a/tests/suite/foundations/calc.typ b/tests/suite/foundations/calc.typ
index e702be9f..18cfa484 100644
--- a/tests/suite/foundations/calc.typ
+++ b/tests/suite/foundations/calc.typ
@@ -1,6 +1,21 @@
--- calc-round ---
#test(calc.round(calc.e, digits: 2), 2.72)
#test(calc.round(calc.pi, digits: 2), 3.14)
+#test(type(calc.round(3.1415, digits: 2)), float)
+#test(type(calc.round(5, digits: 2)), int)
+#test(type(calc.round(decimal("3.1415"), digits: 2)), decimal)
+
+--- calc-round-large-inputs ---
+#test(calc.round(31114, digits: 4000000000), 31114)
+#test(calc.round(9223372036854775807, digits: 12), 9223372036854775807)
+#test(calc.round(238959235.129590203, digits: 4000000000), 238959235.129590203)
+#test(calc.round(1.7976931348623157e+308, digits: 12), 1.7976931348623157e+308)
+#test(calc.round(decimal("238959235.129590203"), digits: 4000000000), decimal("238959235.129590203"))
+#test(calc.round(decimal("79228162514264337593543950335"), digits: 12), decimal("79228162514264337593543950335"))
+
+--- calc-round-negative-digits ---
+// Error: 29-31 number must be at least zero
+#calc.round(243.32, digits: -2)
--- calc-abs ---
// Test the `abs` function.
@@ -11,9 +26,11 @@
#test(calc.abs(-3.14), 3.14)
#test(calc.abs(50%), 50%)
#test(calc.abs(-25%), 25%)
+#test(calc.abs(decimal("4932.493249324932")), decimal("4932.493249324932"))
+#test(calc.abs(decimal("-12402.593295932041")), decimal("12402.593295932041"))
---- cals-abs-bad-type ---
-// Error: 11-22 expected integer, float, length, angle, ratio, or fraction, found string
+--- calc-abs-bad-type ---
+// Error: 11-22 expected integer, float, length, angle, ratio, fraction, or decimal, found string
#calc.abs("no number")
--- calc-even-and-odd ---
@@ -30,6 +47,13 @@
#test(calc.rem(5, -3), 2)
#test(calc.rem(22.5, 10), 2.5)
#test(calc.rem(9, 4.5), 0)
+#test(calc.rem(decimal("5"), -3), decimal("2"))
+#test(calc.rem(decimal("22.5"), decimal("10")), decimal("2.5"))
+#test(calc.rem(9, decimal("4.5")), decimal("0"))
+#test(calc.rem(decimal("7"), decimal("3")), decimal("1"))
+#test(calc.rem(decimal("7"), decimal("-3")), decimal("1"))
+#test(calc.rem(decimal("-7"), decimal("3")), decimal("-1"))
+#test(calc.rem(decimal("-7"), decimal("-3")), decimal("-1"))
--- calc-rem-divisor-zero-1 ---
// Error: 14-15 divisor must not be zero
@@ -39,6 +63,10 @@
// Error: 16-19 divisor must not be zero
#calc.rem(3.0, 0.0)
+--- calc-rem-divisor-zero-3 ---
+// Error: 27-39 divisor must not be zero
+#calc.rem(decimal("4.0"), decimal("0"))
+
--- calc-div-euclid ---
// Test the `div-euclid` function.
#test(calc.div-euclid(7, 3), 2)
@@ -46,6 +74,11 @@
#test(calc.div-euclid(-7, 3), -3)
#test(calc.div-euclid(-7, -3), 3)
#test(calc.div-euclid(2.5, 2), 1)
+#test(calc.div-euclid(decimal("7"), decimal("3")), decimal("2"))
+#test(calc.div-euclid(decimal("7"), decimal("-3")), decimal("-2"))
+#test(calc.div-euclid(decimal("-7"), decimal("3")), decimal("-3"))
+#test(calc.div-euclid(decimal("-7"), decimal("-3")), decimal("3"))
+#test(calc.div-euclid(decimal("2.5"), decimal("2")), decimal("1"))
--- calc-div-euclid-divisor-zero-1 ---
// Error: 21-22 divisor must not be zero
@@ -55,6 +88,10 @@
// Error: 23-26 divisor must not be zero
#calc.div-euclid(3.0, 0.0)
+--- calc-div-euclid-divisor-zero-3 ---
+// Error: 35-50 divisor must not be zero
+#calc.div-euclid(decimal("3.00"), decimal("0.00"))
+
--- calc-rem-euclid ---
// Test the `rem-euclid` function.
#test(calc.rem-euclid(7, 3), 1)
@@ -62,6 +99,11 @@
#test(calc.rem-euclid(-7, 3), 2)
#test(calc.rem-euclid(-7, -3), 2)
#test(calc.rem-euclid(2.5, 2), 0.5)
+#test(calc.rem-euclid(decimal("7"), decimal("3")), decimal("1"))
+#test(calc.rem-euclid(decimal("7"), decimal("-3")), decimal("1"))
+#test(calc.rem-euclid(decimal("-7"), decimal("3")), decimal("2"))
+#test(calc.rem-euclid(decimal("-7"), decimal("-3")), decimal("2"))
+#test(calc.rem-euclid(decimal("2.5"), decimal("2")), decimal("0.5"))
--- calc-rem-euclid-divisor-zero-1 ---
// Error: 21-22 divisor must not be zero
@@ -71,13 +113,19 @@
// Error: 23-26 divisor must not be zero
#calc.rem-euclid(3.0, 0.0)
+--- calc-rem-euclid-divisor-zero-3 ---
+// Error: 35-50 divisor must not be zero
+#calc.rem-euclid(decimal("3.00"), decimal("0.00"))
+
--- calc-quo ---
// Test the `quo` function.
#test(calc.quo(1, 1), 1)
#test(calc.quo(5, 3), 1)
#test(calc.quo(5, -3), -1)
-#test(calc.quo(22.5, 10), 2)
-#test(calc.quo(9, 4.5), 2)
+#test(calc.quo(22.5, 10), 2.0)
+#test(calc.quo(9, 4.5), 2.0)
+#test(calc.quo(decimal("22.5"), 10), decimal("2"))
+#test(calc.quo(decimal("9"), decimal("4.5")), decimal("2"))
--- calc-quo-divisor-zero-1 ---
// Error: 14-15 divisor must not be zero
@@ -87,17 +135,24 @@
// Error: 16-19 divisor must not be zero
#calc.quo(3.0, 0.0)
+--- calc-quo-divisor-zero-3 ---
+// Error: 27-41 divisor must not be zero
+#calc.quo(decimal("4.0"), decimal("0.0"))
+
--- calc-min-and-max ---
// Test the `min` and `max` functions.
#test(calc.min(2, -4), -4)
#test(calc.min(3.5, 1e2, -0.1, 3), -0.1)
+#test(calc.min(decimal("3.5"), 4, decimal("-3213.99999")), decimal("-3213.99999"))
#test(calc.max(-3, 11), 11)
+#test(calc.max(decimal("3"), 45), 45)
#test(calc.min("hi"), "hi")
--- calc-pow-log-exp-ln ---
// Test the `pow`, `log`, `exp`, and `ln` functions.
#test(calc.pow(10, 0), 1)
#test(calc.pow(2, 4), 16)
+#test(calc.pow(decimal("0.5"), 18), decimal("0.000003814697265625"))
#test(calc.exp(2), calc.pow(calc.e, 2))
#test(calc.ln(10), calc.log(10, base: calc.e))
@@ -156,6 +211,10 @@
// Error: 2-25 the result is too large
#calc.pow(2, 2147483647)
+--- calc-pow-too-large-decimal ---
+// Error: 2-56 the result is too large
+#calc.pow(decimal("2222222222222222222222222222"), 100)
+
--- calc-pow-bad-exponent ---
// Error: 14-36 exponent may not be infinite, subnormal, or NaN
#calc.pow(2, calc.pow(2.0, 10000.0))
@@ -248,6 +307,30 @@
// Error: 2-41 the result is too large
#calc.lcm(15486487489457, 4874879896543)
+--- calc-rounding-larger-than-max-int ---
+#test(calc.round(decimal("9223372036854775809.5")), decimal("9223372036854775810"))
+#test(calc.round(9223372036854775809.5), 9223372036854775810.0)
+#test(calc.floor(decimal("9223372036854775809.5")), decimal("9223372036854775809"))
+#test(calc.floor(9223372036854775809.5), 9223372036854775809.0)
+#test(calc.ceil(decimal("9223372036854775809.5")), decimal("9223372036854775810"))
+#test(calc.ceil(9223372036854775809.5), 9223372036854775810.0)
+#test(calc.trunc(decimal("9223372036854775809.5")), decimal("9223372036854775809"))
+#test(calc.trunc(9223372036854775809.5), 9223372036854775809.0)
+#test(calc.quo(decimal("9223372036854775809.5"), 1), decimal("9223372036854775809"))
+#test(calc.quo(9223372036854775809.5, 1), 9223372036854775809.0)
+
+--- calc-rounding-smaller-than-min-int ---
+#test(calc.round(decimal("-9223372036854775809.5")), decimal("-9223372036854775810"))
+#test(calc.round(-9223372036854775809.5), -9223372036854775810.0)
+#test(calc.floor(decimal("-9223372036854775809.5")), decimal("-9223372036854775810"))
+#test(calc.floor(-9223372036854775809.5), -9223372036854775810.0)
+#test(calc.ceil(decimal("-9223372036854775809.5")), decimal("-9223372036854775809"))
+#test(calc.ceil(-9223372036854775809.5), -9223372036854775809.0)
+#test(calc.trunc(decimal("-9223372036854775809.5")), decimal("-9223372036854775809"))
+#test(calc.trunc(-9223372036854775809.5), -9223372036854775809.0)
+#test(calc.quo(decimal("-9223372036854775809.5"), 1), decimal("-9223372036854775810"))
+#test(calc.quo(-9223372036854775809.5, 1), -9223372036854775810.0)
+
--- calc-min-nothing ---
// Error: 2-12 expected at least one value
#calc.min()
@@ -259,3 +342,8 @@
--- calc-max-uncomparable ---
// Error: 16-19 cannot compare 1pt with 1em
#calc.max(1em, 1pt)
+
+--- calc-clamp-decimal-float ---
+// Error: 2-37 cannot apply this operation to a decimal and a float
+// Hint: 2-37 if loss of precision is acceptable, explicitly cast the decimal to a float with `float(value)`
+#calc.clamp(decimal("10"), 5.5, 6.6)
diff --git a/tests/suite/foundations/decimal.typ b/tests/suite/foundations/decimal.typ
new file mode 100644
index 00000000..d5fd9444
--- /dev/null
+++ b/tests/suite/foundations/decimal.typ
@@ -0,0 +1,79 @@
+--- decimal-constructor ---
+#test(decimal(10), decimal("10.0"))
+#test(decimal("-7654.321"), decimal("-7654.321"))
+#test(decimal("\u{2212}7654.321"), decimal("-7654.321"))
+#test(decimal({ 3.141592653 }), decimal("3.141592653000000012752934707"))
+#test(decimal({ -3.141592653 }), decimal("-3.141592653000000012752934707"))
+#test(type(decimal(10)), decimal)
+
+--- decimal-constructor-bad-type ---
+// Error: 10-17 expected integer, float, or string, found type
+#decimal(decimal)
+
+--- decimal-constructor-bad-value ---
+// Error: 10-17 invalid decimal: 1.2.3
+#decimal("1.2.3")
+
+--- decimal-constructor-float-literal ---
+// Warning: 18-25 creating a decimal using imprecise float literal
+// Hint: 18-25 use a string in the decimal constructor to avoid loss of precision: `decimal("1.32523")`
+#let _ = decimal(1.32523)
+
+--- decimal-constructor-float-inf ---
+// Error: 10-19 float is not a valid decimal: float.inf
+#decimal(float.inf)
+
+--- decimal-constructor-float-negative-inf ---
+// Error: 10-20 float is not a valid decimal: -float.inf
+#decimal(-float.inf)
+
+--- decimal-constructor-float-nan ---
+// Error: 10-19 float is not a valid decimal: float.nan
+#decimal(float.nan)
+
+--- decimal-repr ---
+// Test the `repr` function with decimals.
+#test(repr(decimal("12.0")), "decimal(\"12.0\")")
+#test(repr(decimal("3.14")), "decimal(\"3.14\")")
+#test(repr(decimal("1234567890.0")), "decimal(\"1234567890.0\")")
+#test(repr(decimal("0123456789.0")), "decimal(\"123456789.0\")")
+#test(repr(decimal("0.0")), "decimal(\"0.0\")")
+#test(repr(decimal("-0.0")), "decimal(\"0.0\")")
+#test(repr(decimal("-1.0")), "decimal(\"-1.0\")")
+#test(repr(decimal("-9876543210.0")), "decimal(\"-9876543210.0\")")
+#test(repr(decimal("-0987654321.0")), "decimal(\"-987654321.0\")")
+#test(repr(decimal("-3.14")), "decimal(\"-3.14\")")
+#test(repr(decimal("-3.9191919191919191919191919195")), "decimal(\"-3.9191919191919191919191919195\")")
+#test(repr(decimal("5.0000000000")), "decimal(\"5.0000000000\")")
+#test(repr(decimal("4.0") - decimal("8.0")), "decimal(\"-4.0\")")
+
+--- decimal-display ---
+// Test decimals.
+#set page(width: auto)
+#decimal("12.0") \
+#decimal("3.14") \
+#decimal("1234567890.0") \
+#decimal("0123456789.0") \
+#decimal("0.0") \
+#decimal("-0.0") \
+#decimal("-1.0") \
+#decimal("-9876543210.0") \
+#decimal("-0987654321.0") \
+#decimal("-3.14") \
+#decimal("-3.9191919191919191919191919195") \
+#decimal("5.0000000000") \
+#(decimal("4.0") - decimal("8.0"))
+
+--- decimal-display-round ---
+// Display less digits.
+#calc.round(decimal("-3.9191919191919191919191919195"), digits: 4) \
+#calc.round(decimal("5.0000000000"), digits: 4)
+
+--- decimal-expected-float-error ---
+// Error: 11-25 expected integer, float, or angle, found decimal
+// Hint: 11-25 if loss of precision is acceptable, explicitly cast the decimal to a float with `float(value)`
+#calc.sin(decimal("1.1"))
+
+--- decimal-expected-integer-error ---
+// Error: 11-25 expected integer, found decimal
+#calc.odd(decimal("1.1"))
diff --git a/tests/suite/foundations/float.typ b/tests/suite/foundations/float.typ
index 67d4acbf..2e9e07f2 100644
--- a/tests/suite/foundations/float.typ
+++ b/tests/suite/foundations/float.typ
@@ -6,10 +6,14 @@
#test(float("3.1415"), 3.1415)
#test(float("-7654.321"), -7654.321)
#test(float("\u{2212}7654.321"), -7654.321)
+#test(float(decimal("4.89")), 4.89)
+#test(float(decimal("3.1234567891234567891234567891")), 3.123456789123457)
+#test(float(decimal("79228162514264337593543950335")), 79228162514264340000000000000.0)
+#test(float(decimal("-79228162514264337593543950335")), -79228162514264340000000000000.0)
#test(type(float(10)), float)
--- float-constructor-bad-type ---
-// Error: 8-13 expected float, boolean, integer, ratio, or string, found type
+// Error: 8-13 expected float, boolean, integer, decimal, ratio, or string, found type
#float(float)
--- float-constructor-bad-value ---
@@ -55,20 +59,20 @@
--- float-repr ---
// Test the `repr` function with floats.
-#repr(12.0) \
-#repr(3.14) \
-#repr(1234567890.0) \
-#repr(0123456789.0) \
-#repr(0.0) \
-#repr(-0.0) \
-#repr(-1.0) \
-#repr(-9876543210.0) \
-#repr(-0987654321.0) \
-#repr(-3.14) \
-#repr(4.0 - 8.0) \
-#repr(float.inf) \
-#repr(-float.inf) \
-#repr(float.nan)
+#test(repr(12.0), "12.0")
+#test(repr(3.14), "3.14")
+#test(repr(1234567890.0), "1234567890.0")
+#test(repr(0123456789.0), "123456789.0")
+#test(repr(0.0), "0.0")
+#test(repr(-0.0), "-0.0")
+#test(repr(-1.0), "-1.0")
+#test(repr(-9876543210.0), "-9876543210.0")
+#test(repr(-0987654321.0), "-987654321.0")
+#test(repr(-3.14), "-3.14")
+#test(repr(4.0 - 8.0), "-4.0")
+#test(repr(float.inf), "float.inf")
+#test(repr(-float.inf), "-float.inf")
+#test(repr(float.nan), "float.nan")
--- float-display ---
// Test floats.
diff --git a/tests/suite/foundations/int.typ b/tests/suite/foundations/int.typ
index 1744ef88..9cb27cf5 100644
--- a/tests/suite/foundations/int.typ
+++ b/tests/suite/foundations/int.typ
@@ -21,15 +21,34 @@
#test(int("-834"), -834)
#test(int("\u{2212}79"), -79)
#test(int(10 / 3), 3)
+#test(int(-58.34), -58)
+#test(int(decimal("92492.193848921")), 92492)
+#test(int(decimal("-224.342211")), -224)
--- int-constructor-bad-type ---
-// Error: 6-10 expected integer, boolean, float, or string, found length
+// Error: 6-10 expected integer, boolean, float, decimal, or string, found length
#int(10pt)
--- int-constructor-bad-value ---
// Error: 6-12 invalid integer: nope
#int("nope")
+--- int-constructor-float-too-large ---
+// Error: 6-27 number too large
+#int(9223372036854775809.5)
+
+--- int-constructor-float-too-large-min ---
+// Error: 6-28 number too large
+#int(-9223372036854775809.5)
+
+--- int-constructor-decimal-too-large ---
+// Error: 6-38 number too large
+#int(decimal("9223372036854775809.5"))
+
+--- int-constructor-decimal-too-large-min ---
+// Error: 6-39 number too large
+#int(decimal("-9223372036854775809.5"))
+
--- int-signum ---
// Test int `signum()`
#test(int(0).signum(), 0)
@@ -58,15 +77,15 @@
--- int-repr ---
// Test the `repr` function with integers.
-#repr(12) \
-#repr(1234567890) \
-#repr(0123456789) \
-#repr(0) \
-#repr(-0) \
-#repr(-1) \
-#repr(-9876543210) \
-#repr(-0987654321) \
-#repr(4 - 8)
+#test(repr(12), "12")
+#test(repr(1234567890), "1234567890")
+#test(repr(0123456789), "123456789")
+#test(repr(0), "0")
+#test(repr(-0), "0")
+#test(repr(-1), "-1")
+#test(repr(-9876543210), "-9876543210")
+#test(repr(-0987654321), "-987654321")
+#test(repr(4 - 8), "-4")
--- int-display ---
// Test integers.
diff --git a/tests/suite/foundations/str.typ b/tests/suite/foundations/str.typ
index 025ec53d..0da11c31 100644
--- a/tests/suite/foundations/str.typ
+++ b/tests/suite/foundations/str.typ
@@ -23,6 +23,24 @@
#test(str(-3.14), "−3.14")
#test(str(4.0 - 8.0), "−4")
+--- str-from-decimal ---
+// Test the `str` function with decimals.
+#test(str(decimal("12")), "12")
+#test(str(decimal("12.0")), "12.0")
+#test(str(decimal("3.14")), "3.14")
+#test(str(decimal("1234567890.0")), "1234567890.0")
+#test(str(decimal("0123456789.0")), "123456789.0")
+#test(str(decimal("0.0")), "0.0")
+#test(str(decimal("-0.0")), "0.0")
+#test(str(decimal("-1.0")), "−1.0")
+#test(str(decimal("-9876543210.0")), "−9876543210.0")
+#test(str(decimal("-0987654321.0")), "−987654321.0")
+#test(str(decimal("-3.14")), "−3.14")
+#test(str(decimal("-3.9191919191919191919191919195")), "−3.9191919191919191919191919195")
+#test(str(decimal("5.0000000000")), "5.0000000000")
+#test(str(decimal("4.0") - decimal("8.0")), "−4.0")
+#test(str(decimal("4") - decimal("8")), "−4")
+
--- str-from-int ---
// Test the `str` function with integers.
#test(str(12), "12")
@@ -36,7 +54,7 @@
#test(str(4 - 8), "−4")
--- str-constructor-bad-type ---
-// Error: 6-8 expected integer, float, version, bytes, label, type, or string, found content
+// Error: 6-8 expected integer, float, decimal, version, bytes, label, type, or string, found content
#str([])
--- str-constructor-bad-base ---
diff --git a/tests/suite/scripting/ops.typ b/tests/suite/scripting/ops.typ
index e0c94e02..d17c0117 100644
--- a/tests/suite/scripting/ops.typ
+++ b/tests/suite/scripting/ops.typ
@@ -8,7 +8,7 @@
// Test math operators.
// Test plus and minus.
-#for v in (1, 3.14, 12pt, 45deg, 90%, 13% + 10pt, 6.3fr) {
+#for v in (1, 3.14, decimal("12.43"), 12pt, 45deg, 90%, 13% + 10pt, 6.3fr) {
// Test plus.
test(+v, v)
@@ -60,6 +60,7 @@
// Mathematical identities.
#let nums = (
1, 3.14,
+ decimal("12.45"),
12pt, 3em, 12pt + 3em,
45deg,
90%,
@@ -76,12 +77,12 @@
test(v - v, 0 * v)
test(v + v, 2 * v)
- // Integer addition does not give a float.
- if type(v) != int {
+ // Integer or decimal addition does not give a float.
+ if type(v) not in (int, decimal) {
test(v + v, 2.0 * v)
}
- if type(v) != relative and ("pt" not in repr(v) or "em" not in repr(v)) {
+ if type(v) not in (relative, decimal) and ("pt" not in repr(v) or "em" not in repr(v)) {
test(v / v, 1.0)
}
}
@@ -112,6 +113,46 @@
}
}
+--- ops-binary-decimal ---
+// Addition.
+#test(decimal("40.1") + decimal("13.2"), decimal("53.3"))
+#test(decimal("12.34330") + decimal("45.96670"), decimal("58.31000"))
+#test(decimal("451113.111111111111111111111") + decimal("23.222222222222222222324"), decimal("451136.333333333333333333435"))
+
+// Subtraction.
+#test(decimal("40.1") - decimal("13.2"), decimal("26.9"))
+#test(decimal("12.34330") - decimal("45.96670"), decimal("-33.62340"))
+#test(decimal("1234.111111111111111111111") - decimal("0.222222222222222222324"), decimal("1233.888888888888888888787"))
+
+// Multiplication.
+#test(decimal("40.5") * decimal("9.5"), decimal("384.75"))
+#test(decimal("-0.1234567890123456789012345678") * decimal("-2.0"), decimal("0.2469135780246913578024691356"))
+
+// Division.
+#test(decimal("1.0") / decimal("7.0"), decimal("0.1428571428571428571428571429"))
+#test(decimal("9999991.6666") / decimal("3.0"), decimal("3333330.5555333333333333333333"))
+#test(decimal("3253452.4034029359598214312040") / decimal("-49293591.4039493929532"), decimal("-0.0660015290170614346071165643"))
+
+--- ops-binary-decimal-int ---
+// Operations between decimal and integer.
+#test(decimal("2359.123456789123456789001234") + 2, decimal("2361.123456789123456789001234"))
+#test(decimal("2359.123456789123456789001234") - 2, decimal("2357.123456789123456789001234"))
+#test(decimal("2359.123456789123456789001234") * 2, decimal("4718.246913578246913578002468"))
+#test(decimal("2359.123456789123456789001234") / 2, decimal("1179.561728394561728394500617"))
+
+--- ops-binary-decimal-multiplication-division-imprecision ---
+// Test digit truncation by multiplication and division.
+#test(decimal("0.7777777777777777777777777777") / 1000, decimal("0.0007777777777777777777777778"))
+#test(decimal("0.7777777777777777777777777777") * decimal("0.001"), decimal("0.0007777777777777777777777778"))
+
+--- ops-add-too-large-decimal ---
+// Error: 3-47 value is too large
+#(decimal("79228162514264337593543950335") + 1)
+
+--- ops-subtract-too-large-decimal ---
+// Error: 3-48 value is too large
+#(decimal("-79228162514264337593543950335") - 1)
+
--- ops-multiply-inf-with-length ---
// Test that multiplying infinite numbers by certain units does not crash.
#(float("inf") * 1pt)
@@ -164,6 +205,8 @@
#test((:) == (a: 1), false)
#test((a: 2 - 1.0, b: 2) == (b: 2, a: 1), true)
#test("a" != "a", false)
+#test(decimal("1.234") == decimal("1.23400000000"), true)
+#test(235 == decimal("235.0"), true)
// Functions compare by identity.
#test(test == test, true)
@@ -202,6 +245,10 @@
#test(() >= (), true)
#test(() <= (1,), true)
#test((1,) <= (), false)
+#test(decimal("123.0000000000000000000000001") > decimal("123.0"), true)
+#test(decimal("123.5") < decimal("122.444"), false)
+#test(decimal("459.9999999999999999999999999") < 460, true)
+#test(decimal("128.50") > 460, false)
--- ops-in ---
// Test `in` operator.