// Path: src/test/java/javafixes/test/Random.java
// @SafeVarargs
// public static int randomInt(int from, int to, Function<Integer, Boolean>... validityConditions) {
//     return generateValidValue(
//             // typecast it to long as otherwise we could get int overflow
//             () -> (int) ((long) (Math.random() * ((long) to - (long) from + 1L)) + (long) from),
//             validityConditions
//     );
// }


import org.junit.Test;
import static javafixes.test.Random.randomInt;
import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertThat;
package javafixes.math;



public class ScaleTest {

    @Test
    public void shouldBeAbleToCreateScale() {
        assertThat(Scale.of(Integer.MIN_VALUE).value, equalTo(Integer.MIN_VALUE));
        assertThat(Scale.scale(Integer.MIN_VALUE).value, equalTo(Integer.MIN_VALUE));
        assertThat(Scale.of(Integer.MAX_VALUE).value, equalTo(Integer.MAX_VALUE));
        assertThat(Scale.scale(Integer.MAX_VALUE).value, equalTo(Integer.MAX_VALUE));
        assertThat(Scale.of(0).value, equalTo(0));
        assertThat(Scale.scale(0).value, equalTo(0));
        assertThat(Scale.of(-1).value, equalTo(-1));
        assertThat(Scale.scale(-1).value, equalTo(-1));
        assertThat(Scale.of(1).value, equalTo(1));
        assertThat(Scale.scale(1).value, equalTo(1));

// Path: src/test/java/javafixes/test/Random.java
// @SafeVarargs
// public static int randomInt(int from, int to, Function<Integer, Boolean>... validityConditions) {
//     return generateValidValue(
//             // typecast it to long as otherwise we could get int overflow
//             () -> (int) ((long) (Math.random() * ((long) to - (long) from + 1L)) + (long) from),
//             validityConditions
//     );
// }


// Path: src/test/java/javafixes/math/ScaleTest.java
import org.junit.Test;
import static javafixes.test.Random.randomInt;
import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertThat;

package javafixes.math;



public class ScaleTest {

    @Test
    public void shouldBeAbleToCreateScale() {
        assertThat(Scale.of(Integer.MIN_VALUE).value, equalTo(Integer.MIN_VALUE));
        assertThat(Scale.scale(Integer.MIN_VALUE).value, equalTo(Integer.MIN_VALUE));
        assertThat(Scale.of(Integer.MAX_VALUE).value, equalTo(Integer.MAX_VALUE));
        assertThat(Scale.scale(Integer.MAX_VALUE).value, equalTo(Integer.MAX_VALUE));
        assertThat(Scale.of(0).value, equalTo(0));
        assertThat(Scale.scale(0).value, equalTo(0));
        assertThat(Scale.of(-1).value, equalTo(-1));
        assertThat(Scale.scale(-1).value, equalTo(-1));
        assertThat(Scale.of(1).value, equalTo(1));
        assertThat(Scale.scale(1).value, equalTo(1));

        int positiveValue = randomInt(2, Integer.MAX_VALUE - 1);