]> git.jsancho.org Git - dungeon-master.git/blob - tests/point.scm
license
[dungeon-master.git] / tests / point.scm
1 ;;; Dungeon Master --- RPG Adventure Generator
2 ;;; Copyright © 2019 Javier Sancho <jsf@jsancho.org>
3 ;;;
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.
8 ;;;
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.
13 ;;;
14 ;;; You should have received a copy of the GNU General Public License
15 ;;; along with Dungeon Master. If not, see <http://www.gnu.org/licenses/>.
16
17
18 (define-module (test-point)
19   #:use-module (srfi srfi-64)
20   #:use-module (dungeon-master geom point))
21
22 (test-begin "point")
23
24 (test-equal
25  "distance"
26  (points-distance
27   (make-point 0 0)
28   (make-point 0 -10))
29  10)
30
31 (test-equal
32  "sum points"
33  (sum-points
34   (make-point 1 2)
35   (make-point 3 4)
36   (make-point 5 6))
37  (make-point 9 12))
38
39 (test-equal
40  "scale point"
41  (scale-point (make-point 2 5) 2.5)
42  (make-point 5.0 12.5))
43
44 (test-end)
45
46 (exit (zero? (test-runner-fail-count (test-runner-current))))