03_point.t 624 B

12345678910111213141516171819202122232425262728
  1. #!/usr/bin/perl
  2. use strict;
  3. use warnings;
  4. use Slic3r::XS;
  5. use Test::More tests => 7;
  6. my $point = Slic3r::Point->new(10, 15);
  7. is_deeply [ @$point ], [10, 15], 'point roundtrip';
  8. my $point2 = $point->clone;
  9. $point2->scale(2);
  10. is_deeply [ @$point2 ], [20, 30], 'scale';
  11. $point2->translate(10, -15);
  12. is_deeply [ @$point2 ], [30, 15], 'translate';
  13. ok $point->coincides_with($point->clone), 'coincides_with';
  14. ok !$point->coincides_with($point2), 'coincides_with';
  15. {
  16. my $point3 = Slic3r::Point->new(4300000, -9880845);
  17. is $point->[0], $point->x, 'x accessor';
  18. is $point->[1], $point->y, 'y accessor';
  19. }
  20. __END__