@@ -11,6 +11,13 @@ TestMathsCatSnippets = class(TTestCase)
1111 procedure StretchRect_A_Except1 ;
1212 procedure StretchRect_A_Except2 ;
1313 procedure StretchRect_B_Except ;
14+ procedure TestSumOfLogs_Single_Except_NonPositive ;
15+ procedure TestSumOfLogs_Double_Except_NonPositive ;
16+ procedure TestSumOfLogs_Extended_Except_NonPositive ;
17+ procedure TestSumOfLogs_Integer_Except_NonPositive ;
18+ procedure TestSumOfLogs_Cardinal_Except_NonPositive ;
19+ procedure TestSumOfLogs_Int64_Except_NonPositive ;
20+ procedure TestSumOfLogs_UInt64_Except_NonPositive ;
1421 procedure TestArithMean_Integer_Except ;
1522 procedure TestArithMean_Cardinal_Except ;
1623 procedure TestArithMean_Double_Except ;
@@ -1698,6 +1705,14 @@ procedure TestMathsCatSnippets.TestSumOfLogs_Cardinal;
16981705 Res := SumOfLogs(PosCardinalArray);
16991706 BoolRes := SameValue(Expected, Res);
17001707 CheckTrue(BoolRes, ' Normal' );
1708+ CheckException(TestSumOfLogs_Cardinal_Except_NonPositive, EArgumentOutOfRangeException, ' Non-positive value' );
1709+ end ;
1710+
1711+ procedure TestMathsCatSnippets.TestSumOfLogs_Cardinal_Except_NonPositive ;
1712+ const
1713+ Bad: array [1 ..2 ] of Cardinal = (12 , 0 );
1714+ begin
1715+ SumOfLogs(Bad);
17011716end ;
17021717
17031718procedure TestMathsCatSnippets.TestSumOfLogs_Double ;
@@ -1709,6 +1724,14 @@ procedure TestMathsCatSnippets.TestSumOfLogs_Double;
17091724 Res := SumOfLogs(PosDoubleArray);
17101725 BoolRes := SameValue(Expected, Res);
17111726 CheckTrue(BoolRes, ' SumOfLogs_Double' );
1727+ CheckException(TestSumOfLogs_Double_Except_NonPositive, EArgumentOutOfRangeException, ' Non-positive value' );
1728+ end ;
1729+
1730+ procedure TestMathsCatSnippets.TestSumOfLogs_Double_Except_NonPositive ;
1731+ const
1732+ Bad: array [1 ..2 ] of Double = (122.0 , -2.1 );
1733+ begin
1734+ SumOfLogs(Bad);
17121735end ;
17131736
17141737procedure TestMathsCatSnippets.TestSumOfLogs_Extended ;
@@ -1720,6 +1743,14 @@ procedure TestMathsCatSnippets.TestSumOfLogs_Extended;
17201743 Res := SumOfLogs(PosExtendedArray);
17211744 BoolRes := SameValue(Expected, Res);
17221745 CheckTrue(BoolRes, ' SumOfLogs_Extended' );
1746+ CheckException(TestSumOfLogs_Extended_Except_NonPositive, EArgumentOutOfRangeException, ' Non-positive value' );
1747+ end ;
1748+
1749+ procedure TestMathsCatSnippets.TestSumOfLogs_Extended_Except_NonPositive ;
1750+ const
1751+ Bad: array [1 ..2 ] of Extended = (122.0 , -2.1 );
1752+ begin
1753+ SumOfLogs(Bad);
17231754end ;
17241755
17251756procedure TestMathsCatSnippets.TestSumOfLogs_Int64 ;
@@ -1731,6 +1762,14 @@ procedure TestMathsCatSnippets.TestSumOfLogs_Int64;
17311762 Res := SumOfLogs(PosInt64Array);
17321763 BoolRes := SameValue(Expected, Res);
17331764 CheckTrue(BoolRes, ' SumOfLogs_Int64' );
1765+ CheckException(TestSumOfLogs_Int64_Except_NonPositive, EArgumentOutOfRangeException, ' Non-positive value' );
1766+ end ;
1767+
1768+ procedure TestMathsCatSnippets.TestSumOfLogs_Int64_Except_NonPositive ;
1769+ const
1770+ Bad: array [1 ..2 ] of Int64 = (12 , -23 );
1771+ begin
1772+ SumOfLogs(Bad);
17341773end ;
17351774
17361775procedure TestMathsCatSnippets.TestSumOfLogs_Integer ;
@@ -1742,6 +1781,14 @@ procedure TestMathsCatSnippets.TestSumOfLogs_Integer;
17421781 Res := SumOfLogs(PosIntegerArray);
17431782 BoolRes := SameValue(Expected, Res);
17441783 CheckTrue(BoolRes, ' SumOfLogs_Integer' );
1784+ CheckException(TestSumOfLogs_Integer_Except_NonPositive, EArgumentOutOfRangeException, ' Non-positive value' );
1785+ end ;
1786+
1787+ procedure TestMathsCatSnippets.TestSumOfLogs_Integer_Except_NonPositive ;
1788+ const
1789+ Bad: array [1 ..2 ] of Integer = (12 , 0 );
1790+ begin
1791+ SumOfLogs(Bad);
17451792end ;
17461793
17471794procedure TestMathsCatSnippets.TestSumOfLogs_Single ;
@@ -1753,6 +1800,14 @@ procedure TestMathsCatSnippets.TestSumOfLogs_Single;
17531800 Res := SumOfLogs(PosSingleArray);
17541801 BoolRes := SameValue(Expected, Res);
17551802 CheckTrue(BoolRes, ' SumOfLogs_Single' );
1803+ CheckException(TestSumOfLogs_Single_Except_NonPositive, EArgumentOutOfRangeException, ' Non-positive value' );
1804+ end ;
1805+
1806+ procedure TestMathsCatSnippets.TestSumOfLogs_Single_Except_NonPositive ;
1807+ const
1808+ Bad: array [1 ..2 ] of Single = (122.0 , -2.1 );
1809+ begin
1810+ SumOfLogs(Bad);
17561811end ;
17571812
17581813procedure TestMathsCatSnippets.TestSumOfLogs_UInt64 ;
@@ -1764,6 +1819,14 @@ procedure TestMathsCatSnippets.TestSumOfLogs_UInt64;
17641819 Res := SumOfLogs(PosUInt64Array);
17651820 BoolRes := SameValue(Expected, Res);
17661821 CheckTrue(BoolRes, ' SumOfLogs_UInt64' );
1822+ CheckException(TestSumOfLogs_UInt64_Except_NonPositive, EArgumentOutOfRangeException, ' Non-positive value' );
1823+ end ;
1824+
1825+ procedure TestMathsCatSnippets.TestSumOfLogs_UInt64_Except_NonPositive ;
1826+ const
1827+ Bad: array [1 ..2 ] of UInt64 = (12 , 0 );
1828+ begin
1829+ SumOfLogs(Bad);
17671830end ;
17681831
17691832procedure TestMathsCatSnippets.TestWeightedArithMean_Cardinal ;
0 commit comments