/*
 * Copyright (c) 2014 Oculus Info Inc.
 * http://www.oculusinfo.com/
 *
 * Released under the MIT License.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy of
 * this software and associated documentation files (the "Software"), to deal in
 * the Software without restriction, including without limitation the rights to
 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
 * of the Software, and to permit persons to whom the Software is furnished to do
 * so, subject to the following conditions:

 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.

 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */
package com.oculusinfo.tile.rendering.value;

import com.oculusinfo.tile.rendering.transformations.value.LinearValueTransformer;
import org.junit.Assert;
import org.junit.Test;

public class LinearValueTransformerTests {
	private final static double EPS = 0.00001;

	@Test
	public void testGeneral () {
		LinearValueTransformer t = new LinearValueTransformer(100,200);
		Assert.assertEquals(t.transform(100.0), 0, EPS);
		Assert.assertEquals(t.transform(150.0), 0.5, EPS);
		Assert.assertEquals(t.transform(200.0), 1, EPS);
	}

	@Test
	public void testOutOfBounds () {
		LinearValueTransformer t = new LinearValueTransformer(100,200);
		Assert.assertEquals(t.transform(90.0), 0, EPS);
		Assert.assertEquals(t.transform(5000.0), 1, EPS);
	}

	@Test
	public void testNegativeSpan () {
		LinearValueTransformer t = new LinearValueTransformer(-10,20);
		Assert.assertEquals(t.transform(-10.0), 0, EPS);
		Assert.assertEquals(t.transform(5.0), 0.5, EPS);
		Assert.assertEquals(t.transform(20.0), 1, EPS);
	}
}

@@ -1561,32 +1561,35 @@
 rt.assertEquals(
+0, 
 t.transform(100.
@@ -1587,27 +1587,24 @@
 form(100.0),
- 0,
  EPS);%0A%09%09Ass
@@ -1612,32 +1612,37 @@
 rt.assertEquals(
+0.5, 
 t.transform(150.
@@ -1640,29 +1640,24 @@
 form(150.0),
- 0.5,
  EPS);%0A%09%09Ass
@@ -1665,32 +1665,35 @@
 rt.assertEquals(
+1, 
 t.transform(200.
@@ -1691,27 +1691,24 @@
 form(200.0),
- 1,
  EPS);%0A%09%7D%0A%0A%09
@@ -1827,32 +1827,35 @@
 rt.assertEquals(
+0, 
 t.transform(90.0
@@ -1852,27 +1852,24 @@
 sform(90.0),
- 0,
  EPS);%0A%09%09Ass
@@ -1877,32 +1877,35 @@
 rt.assertEquals(
+1, 
 t.transform(5000
@@ -1904,27 +1904,24 @@
 orm(5000.0),
- 1,
  EPS);%0A%09%7D%0A%0A%09
@@ -2040,32 +2040,35 @@
 rt.assertEquals(
+0, 
 t.transform(-10.
@@ -2074,11 +2074,8 @@
 .0),
- 0,
  EPS
@@ -2091,32 +2091,37 @@
 rt.assertEquals(
+0.5, 
 t.transform(5.0)
@@ -2125,13 +2125,8 @@
 .0),
- 0.5,
  EPS
@@ -2150,16 +2150,19 @@
 tEquals(
+1, 
 t.transf
@@ -2175,11 +2175,8 @@
 .0),
- 1,
  EPS

Fix tests to use correct order of expected, actual