PageRenderTime 20ms CodeModel.GetById 13ms app.highlight 5ms RepoModel.GetById 2ms app.codeStats 0ms

/sigmah/src/test/java/org/sigmah/server/report/generator/ScaleTest.java

http://sigma-h.googlecode.com/
Java | 36 lines | 19 code | 10 blank | 7 comment | 0 complexity | 0a0e8b41d597abd7f040fd7481b25b0b 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;
 7
 8import junit.framework.Assert;
 9import org.junit.Test;
10
11/**
12 * @author Alex Bertram
13 */
14public class ScaleTest {
15
16    @Test
17    public void testScale() {
18
19        ScaleUtil.Scale s = ScaleUtil.computeScale(1.2, 4.2, 10);
20
21        Assert.assertEquals(0.0, s.valmin);
22        Assert.assertEquals(4.5, s.valmax);
23        Assert.assertEquals(0.5, s.step);
24    }
25
26    @Test
27    public void testLargeScale() {
28
29        ScaleUtil.Scale s = ScaleUtil.computeScale(1500, 9000, 10);
30
31        Assert.assertEquals("valmin", 1000.0, s.valmin);
32        Assert.assertEquals("valmax", 10000.0, s.valmax);
33        Assert.assertEquals("step", 1000.0, s.step);
34    }
35
36}