@@ -87,10 +87,30 @@ BOOST_AUTO_TEST_CASE(GetFeeTest)
87
87
CFeeRate (MAX_MONEY, std::numeric_limits<uint32_t >::max ()).GetFeePerK ();
88
88
89
89
// check multiplication operator
90
+ // check multiplying by zero
90
91
feeRate = CFeeRate (1000 );
91
92
BOOST_CHECK (0 * feeRate == CFeeRate (0 ));
93
+ BOOST_CHECK (feeRate * 0 == CFeeRate (0 ));
94
+ // check multiplying by a positive integer
92
95
BOOST_CHECK (3 * feeRate == CFeeRate (3000 ));
96
+ BOOST_CHECK (feeRate * 3 == CFeeRate (3000 ));
97
+ // check multiplying by a negative integer
93
98
BOOST_CHECK (-3 * feeRate == CFeeRate (-3000 ));
99
+ BOOST_CHECK (feeRate * -3 == CFeeRate (-3000 ));
100
+ // check commutativity
101
+ BOOST_CHECK (2 * feeRate == feeRate * 2 );
102
+ // check with large numbers
103
+ int largeNumber = 1000000 ;
104
+ BOOST_CHECK (largeNumber * feeRate == feeRate * largeNumber);
105
+ // check boundary values
106
+ int maxInt = std::numeric_limits<int >::max ();
107
+ feeRate = CFeeRate (maxInt);
108
+ BOOST_CHECK (feeRate * 2 == CFeeRate (static_cast <int64_t >(maxInt) * 2 ));
109
+ BOOST_CHECK (2 * feeRate == CFeeRate (static_cast <int64_t >(maxInt) * 2 ));
110
+ // check with zero fee rate
111
+ feeRate = CFeeRate (0 );
112
+ BOOST_CHECK (feeRate * 5 == CFeeRate (0 ));
113
+ BOOST_CHECK (5 * feeRate == CFeeRate (0 ));
94
114
}
95
115
96
116
BOOST_AUTO_TEST_CASE (BinaryOperatorTest)
0 commit comments