1 ;;; Dungeon Master --- Adventure generator for GNU Guile
2 ;;; Copyright © 2019 Javier Sancho <jsf@jsancho.org>
4 ;;; Dungeon Master is free software; you can redistribute it and/or modify it
5 ;;; under the terms of the GNU General Public License as published by
6 ;;; the Free Software Foundation; either version 3 of the License, or
7 ;;; (at your option) any later version.
9 ;;; Dungeon Master is distributed in the hope that it will be useful, but
10 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
11 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 ;;; General Public License for more details.
14 ;;; You should have received a copy of the GNU General Public License
15 ;;; along with Haunt. If not, see <http://www.gnu.org/licenses/>.
18 (define-module (test-point)
19 #:use-module (srfi srfi-64)
20 #:use-module (dungeon-master geom point)
21 #:use-module (dungeon-master geom triangle))
23 (test-begin "triangle")
25 (define p1 (make-point 0 0))
26 (define p2 (make-point 0 10))
27 (define p3 (make-point 10 0))
28 (define tr (make-triangle p1 p2 p3))
37 (= (triangle-radius tr)
38 (points-distance (triangle-center tr) p1)
39 (points-distance (triangle-center tr) p2)
40 (points-distance (triangle-center tr) p3)))
44 (and (triangle-has-edge tr p1 p2)
45 (triangle-has-edge tr p2 p1)
46 (triangle-has-edge tr p3 p1)))
50 (exit (zero? (test-runner-fail-count (test-runner-current))))