Erik's ToolBox Documentation
Index

Interpreter Test Reference — Types and Conversion

These tests verify the type system: per-type assignment and arithmetic, BigInteger, the automatic conversions between compatible types, native date/time representation, and the default values types take. Several are native-mirror tests that also run on Microsoft's AL runtime to pin the exact semantics.

Test List

Test What it verifies
TypeAssignmentTests Assignment, arithmetic, clear, format, and evaluate for every simple type: Integer (incl. div/mod), Decimal, Text, Code (uppercased and trimmed), Boolean, Date (with date arithmetic), Time, DateTime, Duration, Guid, DateFormula, and Option (including :: members).
BigIntegerTests BigInteger beyond the Int32 range: default value, assignment, arithmetic, div/mod, comparison, clear, conversion to/from Integer and Decimal, format/evaluate, use as a for counter and case label, procedure return and var parameter, JsonValue.AsBigInteger round-trip, use in a List, and read/write and getrangemax on a BigInteger record field.
DateMinusDateConversionTests Date - Date yields the day count across every operand shape: variables, literals, built-ins (today), calcdate, user procedures, and record fields; result assignable to Integer and Decimal and usable in comparisons. Native-mirrored.
DatePlusIntegerConversionTests Date + Integer and Date - Integer yield a Date for literal, variable, procedure, and built-in operands. Native-mirrored.
TimeAndDateTimeConversionTests Time ± Integer yields Time; Time - Time and DateTime - DateTime yield a Duration (also assignable to Integer); DateTime ± Integer/Duration yields DateTime. Native-mirrored.
DurationConversionTests Integer literals into Duration, Duration arithmetic, and Duration ↔ Integer/Decimal conversions. Native-mirrored.
ExistingConversionRegressionTests Long-standing conversions: Integer→Decimal (literal and procedure result), Code→Text (uppercased), Text→Code, Guid→Text, and companyname() into a Code.
DecimalToIntegerStoreTests Whole-valued decimals convert to Integer (3.0→3); fractional values raise an overflow error rather than rounding — matching native AL, which is pinned by a native-spec mirror.
DateTimeRepresentationTests Native date/time representation: 0T is the undefined time (distinct from midnight, formats empty); closing dates carry a marker that survives variables, comparison, formatting, record fields, and SetRange, and normaldate strips it. Native-spec mirrored.
DateTimeDurationArithmeticTests DateTime + Duration computes in 64-bit, so durations beyond the ~24.8-day Int32 millisecond range (and large duration sums) advance the datetime correctly without overflow.
GuidDefaultTests An unassigned Guid (global, procedure-local, or a no-exit Guid return) formats as the braced null GUID {00000000-…}, matching a cleared Guid and the native default.