#lang racket (require rackunit/text-ui) (require rackunit "../triangle-button.rkt") (define test-triangle (test-suite "test-triangle" (test-case "test-point-in" (let ([test-triangle (new triangle% [name 'a1] [start-point-x 100] [start-point-y 100] [width 100] [height 50] [direction 'up])]) (check-equal? (send test-triangle point-in? 100 100) #t) (check-equal? (send test-triangle point-in? 200 100) #t) (check-equal? (send test-triangle point-in? 150 50) #t) (check-equal? (send test-triangle point-in? 100 50) #f) (check-equal? (send test-triangle point-in? 200 50) #f) (check-equal? (send test-triangle point-in? 100 51) #f) (check-equal? (send test-triangle point-in? 200 101) #f) (check-equal? (send test-triangle point-in? 200 99) #f) (check-equal? (send test-triangle point-in? 200 99) #f)) (let ([test-triangle (new triangle% [name 'a1] [start-point-x 100] [start-point-y 100] [width 100] [height 50] [direction 'down])]) (check-equal? (send test-triangle point-in? 100 100) #t) (check-equal? (send test-triangle point-in? 200 100) #t) (check-equal? (send test-triangle point-in? 100 50) #f) (check-equal? (send test-triangle point-in? 100 150) #f) (check-equal? (send test-triangle point-in? 150 150) #t) (check-equal? (send test-triangle point-in? 150 150) #t)) ))) (run-tests test-triangle)