Skip to content

Commit

Permalink
[agx - Rust] Test RectInsets
Browse files Browse the repository at this point in the history
  • Loading branch information
codyd51 committed Feb 12, 2024
1 parent c9c9027 commit 15e4a8b
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions rust_programs/agx_definitions/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -956,10 +956,11 @@ impl Debug for Tile {

#[cfg(test)]
mod test {
use crate::println;
use alloc::vec;
use alloc::vec::Vec;

use crate::{Line, Point, PointF64, Rect, Tile, TileSegment, TileSegments};
use std::println;

#[test]
fn test_tiles_visible_in_layer() {
Expand Down Expand Up @@ -1133,7 +1134,7 @@ mod test {
----------
*/
for a in main.area_excluding_rect(exclude) {
println!("{a}");
//println!("{a}");
}
assert_eq!(
main.area_excluding_rect(exclude),
Expand Down Expand Up @@ -1171,7 +1172,7 @@ mod test {
----------
*/
for a in main.area_excluding_rect(exclude) {
println!("{a}");
//println!("{a}");
}
assert_eq!(
main.area_excluding_rect(exclude),
Expand All @@ -1196,7 +1197,7 @@ mod test {
----------------------------
*/
for a in main.area_excluding_rect(exclude) {
println!("{a}");
//println!("{a}");
}
assert_eq!(
main.area_excluding_rect(exclude),
Expand Down Expand Up @@ -1273,6 +1274,19 @@ mod test {
// let s2 = LineInterval::line_segment(b);
// let relation = LineRelation::DivergentIntersecting((1.0, 0.25).into());
}

#[test]
fn test_inset_by() {
let r = Rect::new(0, 0, 100, 100);
let inset = r.inset_by(0, 0, 0, 0);
assert_eq!(r, inset);

let inset = r.inset_by(10, 10, 10, 10);
assert_eq!(inset, Rect::new(10, 10, 80, 80));

let inset = r.inset_by(10, 10, 40, 10);
assert_eq!(inset, Rect::new(10, 10, 50, 80));
}
}

/// For FFI
Expand Down

0 comments on commit 15e4a8b

Please sign in to comment.