|
1 | 1 | (ns bounds-test
|
2 | 2 | (:require
|
3 |
| - [cljs.test :refer-macros [deftest testing is]] |
| 3 | + [cljs.test :refer-macros [deftest testing are is]] |
4 | 4 | [renderer.utils.bounds :as bounds]))
|
5 | 5 |
|
6 | 6 | (deftest test-union
|
7 | 7 | (testing "united bounds"
|
8 |
| - (is (= (bounds/union [0 0 10 10] [11 11 20 20]) [0 0 20 20])) |
9 |
| - (is (= (bounds/union [0 0 10 10] [9 9 20 20]) [0 0 20 20])) |
10 |
| - (is (= (bounds/union [11 11 11 11] [0 0 0 0]) [0 0 11 11])))) |
11 |
| - |
| 8 | + (are [x y] (= x y) |
| 9 | + [0 0 20 20] (bounds/union [0 0 10 10] [11 11 20 20]) |
| 10 | + [0 0 20 20] (bounds/union [0 0 10 10] [9 9 20 20]) |
| 11 | + [0 0 11 11] (bounds/union [11 11 11 11] [0 0 0 0])))) |
12 | 12 |
|
13 | 13 | (deftest test-intersect?
|
14 | 14 | (testing "bounds are intesrecting"
|
15 |
| - (is (= (bounds/intersect? [0 0 10 10] [11 11 20 20]) false)) |
16 |
| - (is (= (bounds/intersect? [0 0 10 10] [9 9 20 20]) true)) |
17 |
| - (is (= (bounds/intersect? [0 0 10 10] [10 10 11 11]) true)))) |
| 15 | + (are [x y] (= x y) |
| 16 | + false (bounds/intersect? [0 0 10 10] [11 11 20 20]) |
| 17 | + true (bounds/intersect? [0 0 10 10] [9 9 20 20]) |
| 18 | + true (bounds/intersect? [0 0 10 10] [10 10 11 11])))) |
18 | 19 |
|
19 | 20 | (deftest test-contained?
|
20 | 21 | (testing "bounds are contained"
|
21 |
| - (is (= (bounds/contained? [0 0 10 10] [0 0 10 10]) false)) |
22 |
| - (is (= (bounds/contained? [5 5 10 10] [0 0 20 20]) true)) |
23 |
| - (is (= (bounds/contained? [0 0 10 10] [1 1 10 10]) false)))) |
| 22 | + (are [x y] (= x y) |
| 23 | + false (bounds/contained? [0 0 10 10] [0 0 10 10]) |
| 24 | + true (bounds/contained? [5 5 10 10] [0 0 20 20]) |
| 25 | + false (bounds/contained? [0 0 10 10] [1 1 10 10])))) |
24 | 26 |
|
25 | 27 | (deftest test-contain-point?
|
26 | 28 | (testing "bounds contain point"
|
27 |
| - (is (= (bounds/contain-point? [0 0 10 10] [0 0]) true)) |
28 |
| - (is (= (bounds/contain-point? [0 0 10 10] [5 5]) true)) |
29 |
| - (is (= (bounds/contain-point? [0 0 10 10] [10 10]) true)) |
30 |
| - (is (= (bounds/contain-point? [0 0 10 10] [-5 5]) false)) |
31 |
| - (is (= (bounds/contain-point? [0 0 10 10] [5 -5]) false)))) |
| 29 | + (are [x y] (= x y) |
| 30 | + true (bounds/contain-point? [0 0 10 10] [0 0]) |
| 31 | + true (bounds/contain-point? [0 0 10 10] [5 5]) |
| 32 | + true (bounds/contain-point? [0 0 10 10] [10 10]) |
| 33 | + false (bounds/contain-point? [0 0 10 10] [-5 5]) |
| 34 | + false (bounds/contain-point? [0 0 10 10] [5 -5])))) |
32 | 35 |
|
33 | 36 | (deftest test-center
|
34 | 37 | (testing "center of bounds"
|
|
0 commit comments