// Path: public-java/iamcontent-core/src/main/java/com/iamcontent/core/math/MathUtils.java
// public static int clamp(int i, int min, int max) {
// 	return Math.min(max, Math.max(i, min));
// }
// 
// Path: public-java/iamcontent-core/src/main/java/com/iamcontent/core/math/MathUtils.java
// public static double linearConvert(double v, double from1, double from2, double to1, double to2) {
// 	final double fromRange = from2 - from1;
// 	final double toRange = to2 - to1;
// 	final double quotient = (v-from1)/fromRange;
// 	return (quotient * toRange) + to1;
// }


import static com.iamcontent.core.math.MathUtils.clamp;
import static com.iamcontent.core.math.MathUtils.linearConvert;
import static org.junit.Assert.assertEquals;
import org.junit.Test;

		checkIntClamp1to3(3, 4);
	}

	private void checkIntClamp1to3(int expected, int in) {
		assertEquals(expected, clamp(in, 1, 3));
	}

	@Test
	public void testClamp_double() {
		checkDoubleClamp1to3(1, 0);
		checkDoubleClamp1to3(1, 1);
		checkDoubleClamp1to3(2, 2);
		checkDoubleClamp1to3(3, 3);
		checkDoubleClamp1to3(3, 4);
	}

	private void checkDoubleClamp1to3(double expected, double in) {
		assertExactlyEquals(expected, clamp(in, 1.0, 3.0));
	}

	@Test
	public void testLinearConvert() {
		checkLinearConvert(10.0, 0.0);
		checkLinearConvert(20.0, 1.0);
		checkLinearConvert(25.0, 1.5);
		checkLinearConvert(30.0, 2.0);
		checkLinearConvert(40.0, 3.0);
	}

	private void checkLinearConvert(double expected, double in) {

// Path: public-java/iamcontent-core/src/main/java/com/iamcontent/core/math/MathUtils.java
// public static int clamp(int i, int min, int max) {
// 	return Math.min(max, Math.max(i, min));
// }
// 
// Path: public-java/iamcontent-core/src/main/java/com/iamcontent/core/math/MathUtils.java
// public static double linearConvert(double v, double from1, double from2, double to1, double to2) {
// 	final double fromRange = from2 - from1;
// 	final double toRange = to2 - to1;
// 	final double quotient = (v-from1)/fromRange;
// 	return (quotient * toRange) + to1;
// }


// Path: public-java/iamcontent-core/src/test/java/com/iamcontent/core/math/MathUtilsTest.java
import static com.iamcontent.core.math.MathUtils.clamp;
import static com.iamcontent.core.math.MathUtils.linearConvert;
import static org.junit.Assert.assertEquals;
import org.junit.Test;

		checkIntClamp1to3(3, 4);
	}

	private void checkIntClamp1to3(int expected, int in) {
		assertEquals(expected, clamp(in, 1, 3));
	}

	@Test
	public void testClamp_double() {
		checkDoubleClamp1to3(1, 0);
		checkDoubleClamp1to3(1, 1);
		checkDoubleClamp1to3(2, 2);
		checkDoubleClamp1to3(3, 3);
		checkDoubleClamp1to3(3, 4);
	}

	private void checkDoubleClamp1to3(double expected, double in) {
		assertExactlyEquals(expected, clamp(in, 1.0, 3.0));
	}

	@Test
	public void testLinearConvert() {
		checkLinearConvert(10.0, 0.0);
		checkLinearConvert(20.0, 1.0);
		checkLinearConvert(25.0, 1.5);
		checkLinearConvert(30.0, 2.0);
		checkLinearConvert(40.0, 3.0);
	}

	private void checkLinearConvert(double expected, double in) {

		assertCloseEnough(expected, linearConvert(in, 1.0, 2.0, 20.0, 30.0));
