@@ -1449,6 +1449,38 @@ codeunit 13918 "XRechnung XML Document Tests"
14491449 // [WHEN/THEN] A value with two decimal places is unchanged
14501450 Assert. AreEqual( ' 1.23' , ExportXRechnungDocument. FormatDecimal( 1.23 , false) , ' FormatDecimal(1.23, false) should return '' 1.23'' ' ) ;
14511451 end ;
1452+
1453+ [Test]
1454+ procedure FormatDecimalUnlimitedWithMinTwoDecimalsReturnsTrailingZero() ;
1455+ begin
1456+ // [SCENARIO] FormatDecimalUnlimited with IncludeMinTwoDecimals = true ensures minimum two decimal places while preserving extended precision
1457+ Initialize() ;
1458+
1459+ // [WHEN/THEN] A value with one significant decimal place gets the trailing zero
1460+ Assert. AreEqual( ' 1.10' , ExportXRechnungDocument. FormatDecimalUnlimited( 1.1 , true) , ' FormatDecimalUnlimited(1.1, true) should return '' 1.10'' ' ) ;
1461+ // [WHEN/THEN] A whole number gets two decimal zeros
1462+ Assert. AreEqual( ' 1.00' , ExportXRechnungDocument. FormatDecimalUnlimited( 1 , true) , ' FormatDecimalUnlimited(1, true) should return '' 1.00'' ' ) ;
1463+ // [WHEN/THEN] A value with two decimal places is unchanged
1464+ Assert. AreEqual( ' 1.23' , ExportXRechnungDocument. FormatDecimalUnlimited( 1.23 , true) , ' FormatDecimalUnlimited(1.23, true) should return '' 1.23'' ' ) ;
1465+ // [WHEN/THEN] A value with extended decimal places preserves full precision
1466+ Assert. AreEqual( ' 5.12345' , ExportXRechnungDocument. FormatDecimalUnlimited( 5.12345 , true) , ' FormatDecimalUnlimited(5.12345, true) should return '' 5.12345'' ' ) ;
1467+ end ;
1468+
1469+ [Test]
1470+ procedure FormatDecimalUnlimitedWithoutMinTwoDecimalsUnbounded() ;
1471+ begin
1472+ // [SCENARIO] FormatDecimalUnlimited with IncludeMinTwoDecimals = false uses unlimited precision without minimum decimal places
1473+ Initialize() ;
1474+
1475+ // [WHEN/THEN] A value with one significant decimal place has no trailing zero
1476+ Assert. AreEqual( ' 1.1' , ExportXRechnungDocument. FormatDecimalUnlimited( 1.1 , false) , ' FormatDecimalUnlimited(1.1, false) should return '' 1.1'' ' ) ;
1477+ // [WHEN/THEN] A whole number has no decimal places
1478+ Assert. AreEqual( ' 1' , ExportXRechnungDocument. FormatDecimalUnlimited( 1 , false) , ' FormatDecimalUnlimited(1, false) should return '' 1'' ' ) ;
1479+ // [WHEN/THEN] A value with two decimal places is unchanged
1480+ Assert. AreEqual( ' 1.23' , ExportXRechnungDocument. FormatDecimalUnlimited( 1.23 , false) , ' FormatDecimalUnlimited(1.23, false) should return '' 1.23'' ' ) ;
1481+ // [WHEN/THEN] A value with extended decimal places preserves full precision
1482+ Assert. AreEqual( ' 5.12345' , ExportXRechnungDocument. FormatDecimalUnlimited( 5.12345 , false) , ' FormatDecimalUnlimited(5.12345, false) should return '' 5.12345'' ' ) ;
1483+ end ;
14521484 #endregion
14531485
14541486 local procedure CreateAndPostSalesDocument( DocumentType: Enum "Sales Document Type"; LineType: Enum "Sales Line Type"; InvoiceDiscount: Boolean ) : Code [20 ];
0 commit comments