Skip to content

Commit 55c649f

Browse files
committed
Statistics.t.sol: remove empty arr test
1 parent 2438d5d commit 55c649f

File tree

1 file changed

+3
-18
lines changed

1 file changed

+3
-18
lines changed

test/Statistics.t.sol

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -173,21 +173,6 @@ contract StatisticsTest is Test {
173173
assert(stddev >= 0);
174174
}
175175

176-
// Test for empty array handling
177-
function test_EmptyArray() external {
178-
uint256[] memory emptyData = new uint256[](0);
179-
180-
// Test division by zero error for empty array
181-
vm.expectRevert(); // or vm.expectRevert(stdError.divisionError);
182-
Statistics.avg(emptyData);
183-
184-
vm.expectRevert();
185-
Statistics.variance(emptyData);
186-
187-
vm.expectRevert();
188-
Statistics.stddev(emptyData);
189-
}
190-
191176
// Test for array bounds
192177
function testFuzz_ArrayBounds(uint8 length) external pure {
193178
// limit array size to prevent overflow and excessive gas costs
@@ -230,7 +215,7 @@ contract StatisticsTest is Test {
230215
}
231216

232217
// Test that variance scales correctly when data is multiplied
233-
function testFuzz_ScaleInvariance(uint8 length, uint8 scale) external {
218+
function testFuzz_ScaleInvariance(uint8 length, uint8 scale) external pure {
234219
vm.assume(length > 0 && length <= 32);
235220
vm.assume(scale > 0 && scale <= 10);
236221

@@ -248,7 +233,7 @@ contract StatisticsTest is Test {
248233
assertApproxEqAbs(variance2, variance1 * scale * scale, 1e15);
249234
}
250235

251-
function testFuzz_OrderInvariance(uint8 length) external {
236+
function testFuzz_OrderInvariance(uint8 length) external view {
252237
vm.assume(length > 1 && length <= 32);
253238

254239
uint256[] memory data = new uint256[](length);
@@ -274,7 +259,7 @@ contract StatisticsTest is Test {
274259
assertEq(variance1, variance2);
275260
}
276261

277-
function testFuzz_ExtremeValues(uint8 length) external {
262+
function testFuzz_ExtremeValues(uint8 length) external pure {
278263
vm.assume(length > 1 && length <= 32); // Must have at least 2 elements
279264

280265
uint256[] memory extremeData = new uint256[](length);

0 commit comments

Comments
 (0)