PageRenderTime 23ms CodeModel.GetById 15ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/sigmah/src/test/java/org/sigmah/server/report/generator/map/CircleMathTest.java

http://sigma-h.googlecode.com/
Java | 43 lines | 25 code | 14 blank | 4 comment | 0 complexity | 6acc930665c29f740fd60467ae020907 MD5 | raw file
 1/*
 2 * All Sigmah code is released under the GNU General Public License v3
 3 * See COPYRIGHT.txt and LICENSE.txt.
 4 */
 5
 6package org.sigmah.server.report.generator.map;
 7
 8import org.junit.Assert;
 9import org.junit.Test;
10import org.sigmah.shared.report.content.Point;
11
12public class CircleMathTest {
13    private static final double DELTA = 0.001;
14
15
16    @Test
17    public void testNoIntersection() {
18
19        Point a = new Point(0, 0);
20        Point b = new Point(5, 0);
21
22        Assert.assertEquals(0.0, CircleMath.intersectionArea(a, b, 1, 2), DELTA);
23
24    }
25
26    @Test
27    public void testTangentIntersection() {
28        Point a = new Point(0, 0);
29        Point b = new Point(2, 0);
30
31        Assert.assertEquals(0.0, CircleMath.intersectionArea(a, b, 1, 1), DELTA);
32    }
33
34    @Test
35    public void testCompletelyContained() {
36        Point a = new Point(297, 212);
37        Point b = new Point(295, 213);
38
39        Assert.assertEquals(CircleMath.area(5), CircleMath.intersectionArea(a, b, 8, 5), DELTA);
40    }
41
42
43}