Skip to content

Commit

Permalink
feat: tests in set grading
Browse files Browse the repository at this point in the history
  • Loading branch information
PedroLeale committed Jan 5, 2024
1 parent 64443c0 commit d0efbeb
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions foundry/test/PeerGrading.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -154,4 +154,21 @@ contract PeerGradingTest is Test {
assertEq(result[i], penalties[i]);
}
}

function test_Grading() public {
// First: this will send an empty array to the grading function
// and it should revert

uint256[] memory grading = new uint256[](0);
vm.expectRevert();
c.setGrading(grading);

// Second: this will send an enormous array to the grading function
// and it should revert

grading = new uint256[](participants.length + 1);
vm.prank(participants[0]);
vm.expectRevert();
c.setGrading(grading);
}
}

0 comments on commit d0efbeb

Please sign in to comment.