Skip to content

Commit 02efc82

Browse files
authored
CON-3821 add unit test instructions to drawing (#3141)
* fix(drawing): add unit tests * fix(drawing): prettier
1 parent f463748 commit 02efc82

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

subjects/drawing/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@ Each shape must be drawn in a different color.
3434

3535
> Don't forget to add the dependencies in your Cargo.toml.
3636
37+
### Unit Tests
38+
39+
You must implement unit tests within your `geometrical_shapes` module to ensure your logic is sound. Specifically, your tests should:
40+
41+
- Verify that `random` functions never produce points outside the specified image dimensions.
42+
- Verify that shapes (like `Rectangle`) are correctly initialized even if the points are provided in reverse order.
43+
- Test edge cases, such as a line where both points are at the same coordinate.
44+
3745
### Bonus
3846

3947
You may optionally implement the following shapes, including the structures and traits needed to draw them:

subjects/drawing/audit/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,16 @@
1818

1919
###### Are the shapes drawn with different colors?
2020

21+
#### Unit Tests
22+
23+
##### Run the command `cargo test`.
24+
25+
###### Do all tests pass without errors?
26+
27+
###### Are there specific tests for the `random` function bounds (e.g., checking that points stay within the image width/height)?
28+
29+
###### Are there tests for shape initialization, such as checking if a `Rectangle` handles inverted coordinates correctly?
30+
2131
#### Bonus
2232

2333
###### +Can you draw a pentagon?

0 commit comments

Comments
 (0)