Skip to content

Commit f463748

Browse files
authored
CON-3822 add unit test instructions to chaikin (#3142)
* fix(chaikin): add unit tests * fix(chaikin): prettier Added requirements for unit tests of the Chaikin algorithm.
1 parent e0315e7 commit f463748

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

subjects/chaikin/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@ You can see how the application should work [here](https://youtu.be/PbB2eKnA2QI)
2828

2929
> You are free to use any library to create and handle windows, rendering, keyboard and mouse events.
3030
31+
### Unit Tests
32+
33+
You must implement unit tests to verify your implementation of the Chaikin algorithm. Your tests should:
34+
35+
- Verify the coordinates of the new points generated after one iteration of the algorithm (cutting the corners at 25% and 75%).
36+
- Verify that the number of points increases correctly per iteration (e.g., for an open curve, $N$ points should result in $2N - 2$ points in the next step).
37+
- Ensure the algorithm handles edge cases, such as an input list of 0, 1, or 2 points, without crashing.
38+
3139
### Bonus
3240

3341
- Make it possible to clear the screen, so that the user can select new control points.

subjects/chaikin/audit/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,18 @@
4040

4141
###### After you pressed `Enter` before selecting points, is it possible to place points without needing to kill the program?
4242

43+
##### Unit Tests
44+
45+
##### Run the command `cargo test`.
46+
47+
###### Do all tests pass without errors?
48+
49+
###### Is there a test that verifies the math of a single Chaikin iteration (calculating the 1/4 and 3/4 points)?
50+
51+
###### Is there a test checking that the point count grows correctly according to the algorithm?
52+
53+
###### Are there tests ensuring the algorithm handles empty or single-point inputs safely?
54+
4355
##### Bonus
4456

4557
###### +When you pressed `Enter` without drawing any points, was a message displayed to inform you that you forgot to draw any points?

0 commit comments

Comments
 (0)