Skip to content

Commit

Permalink
feat!: improve error msg for triangle ex
Browse files Browse the repository at this point in the history
BREAKING CHANGE: forces students to use enums

closes #525
  • Loading branch information
vaeng committed Oct 17, 2023
1 parent c7c669b commit 46a6490
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions exercises/practice/triangle/triangle_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
#endif
#include <stdexcept>

// improves error messages with triangle flavor enum text instead of integers:
CATCH_REGISTER_ENUM(triangle::flavor,
triangle::flavor::equilateral,
triangle::flavor::isosceles,
triangle::flavor::scalene)

TEST_CASE("equilateral_triangles_have_equal_sides")
{
REQUIRE(triangle::flavor::equilateral == triangle::kind(2, 2, 2));
Expand Down

0 comments on commit 46a6490

Please sign in to comment.