// Path: src/main/java/javafixes/collection/CollectionUtil.java
// @SafeVarargs
// public static <T> ArrayList<T> newList(T... values) {
//     ArrayList<T> list = new ArrayList<T>(values.length);
//     Collections.addAll(list, values);
//     return list;
// }
// 
// Path: src/test/java/javafixes/test/Condition.java
// @FunctionalInterface
// public interface Condition<T> extends Function<T, Boolean> {
// 
//     BigInteger MIN_LONG_AS_BIG_INTEGER = BigInteger.valueOf(Long.MIN_VALUE);
//     BigInteger MAX_LONG_AS_BIG_INTEGER = BigInteger.valueOf(Long.MAX_VALUE);
// 
//     @SafeVarargs
//     static <T> Condition<T> otherThan(T... values) {
//         Set<T> exclusions = newSet(values);
//         return value -> !exclusions.contains(value);
//     }
// 
//     static <T extends Number> Condition<T> notDivisibleBy10() {
//         return value -> mod(value, 10) != 0;
//     }
// 
//     static <T extends Number> Condition<T> notZero() {
//         return value -> signum(value) != 0;
//     }
// 
//     static <T extends Number> Condition<T> positive() {
//         return value -> signum(value) == 1;
//     }
// 
//     static <T extends Number> Condition<T> negative() {
//         return value -> signum(value) == -1;
//     }
// 
//     static Condition<BigInteger> fitsIntoLong() {
//         return value -> value.compareTo(MIN_LONG_AS_BIG_INTEGER) >= 0 && value.compareTo(MAX_LONG_AS_BIG_INTEGER) <= 0;
//     }
// 
//     static Condition<BigInteger> notFitIntoLong() {
//         return value -> value.compareTo(MIN_LONG_AS_BIG_INTEGER) < 0 || value.compareTo(MIN_LONG_AS_BIG_INTEGER) > 0;
//     }
// 
//     static int signum(Number value) {
//         if (value instanceof Integer) {
//             return Integer.signum((Integer) value);
//         } else if (value instanceof Long) {
//             return Long.signum((Long) value);
//         } else if (value instanceof BigInteger) {
//             return ((BigInteger) value).signum();
//         } else if (value instanceof BigDecimal) {
//             return ((BigDecimal) value).signum();
//         } else {
//             throw new IllegalArgumentException("Unsupported number type: " + value.getClass());
//         }
//     }
// 
//     static int mod(Number value, int divisor) {
//         if (value instanceof Integer) {
//             return ((Integer) value) % divisor;
//         } else if (value instanceof Long) {
//             return (int) (((Long) value) % divisor);
//         } else if (value instanceof BigInteger) {
//             return ((BigInteger) value).mod(BigInteger.valueOf(divisor)).intValue();
//         } else {
//             throw new IllegalArgumentException("Unsupported number type: " + value.getClass());
//         }
// 
//     }
// }
// 
// 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.collection.CollectionUtil.newList;
import static javafixes.test.Condition.*;
import static javafixes.test.Random.randomInt;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.not;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail;
package javafixes.math;



public class PrecisionTest {

    @Test
    public void shouldCreatePrecisionWithPositiveValue() {

        assertThat(Precision.of(1).value, equalTo(1));
        assertThat(Precision.precision(1).value, equalTo(1));
        assertThat(Precision.of(Integer.MAX_VALUE).value, equalTo(Integer.MAX_VALUE));
        assertThat(Precision.precision(Integer.MAX_VALUE).value, equalTo(Integer.MAX_VALUE));

        int positiveValue = randomInt(2, Integer.MAX_VALUE - 1);
        assertThat(Precision.of(positiveValue).value, equalTo(positiveValue));
        assertThat(Precision.precision(positiveValue).value, equalTo(positiveValue));
    }

    @Test
    public void shouldFailWhenCreatingZeroDigitPrecision() {
        try {
            Precision.of(0);

            fail("zero precision should fail with IllegalArgumentException");
        } catch (IllegalArgumentException expected) {
            // expected
        }

        try {
            Precision.precision(0);

            fail("zero precision should fail with IllegalArgumentException");
        } catch (IllegalArgumentException expected) {
            // expected
        }
    }

    @Test
    public void shouldFailWhenCreatingNegativeDigitPrecision() {
// Path: src/main/java/javafixes/collection/CollectionUtil.java
// @SafeVarargs
// public static <T> ArrayList<T> newList(T... values) {
//     ArrayList<T> list = new ArrayList<T>(values.length);
//     Collections.addAll(list, values);
//     return list;
// }
// 
// Path: src/test/java/javafixes/test/Condition.java
// @FunctionalInterface
// public interface Condition<T> extends Function<T, Boolean> {
// 
//     BigInteger MIN_LONG_AS_BIG_INTEGER = BigInteger.valueOf(Long.MIN_VALUE);
//     BigInteger MAX_LONG_AS_BIG_INTEGER = BigInteger.valueOf(Long.MAX_VALUE);
// 
//     @SafeVarargs
//     static <T> Condition<T> otherThan(T... values) {
//         Set<T> exclusions = newSet(values);
//         return value -> !exclusions.contains(value);
//     }
// 
//     static <T extends Number> Condition<T> notDivisibleBy10() {
//         return value -> mod(value, 10) != 0;
//     }
// 
//     static <T extends Number> Condition<T> notZero() {
//         return value -> signum(value) != 0;
//     }
// 
//     static <T extends Number> Condition<T> positive() {
//         return value -> signum(value) == 1;
//     }
// 
//     static <T extends Number> Condition<T> negative() {
//         return value -> signum(value) == -1;
//     }
// 
//     static Condition<BigInteger> fitsIntoLong() {
//         return value -> value.compareTo(MIN_LONG_AS_BIG_INTEGER) >= 0 && value.compareTo(MAX_LONG_AS_BIG_INTEGER) <= 0;
//     }
// 
//     static Condition<BigInteger> notFitIntoLong() {
//         return value -> value.compareTo(MIN_LONG_AS_BIG_INTEGER) < 0 || value.compareTo(MIN_LONG_AS_BIG_INTEGER) > 0;
//     }
// 
//     static int signum(Number value) {
//         if (value instanceof Integer) {
//             return Integer.signum((Integer) value);
//         } else if (value instanceof Long) {
//             return Long.signum((Long) value);
//         } else if (value instanceof BigInteger) {
//             return ((BigInteger) value).signum();
//         } else if (value instanceof BigDecimal) {
//             return ((BigDecimal) value).signum();
//         } else {
//             throw new IllegalArgumentException("Unsupported number type: " + value.getClass());
//         }
//     }
// 
//     static int mod(Number value, int divisor) {
//         if (value instanceof Integer) {
//             return ((Integer) value) % divisor;
//         } else if (value instanceof Long) {
//             return (int) (((Long) value) % divisor);
//         } else if (value instanceof BigInteger) {
//             return ((BigInteger) value).mod(BigInteger.valueOf(divisor)).intValue();
//         } else {
//             throw new IllegalArgumentException("Unsupported number type: " + value.getClass());
//         }
// 
//     }
// }
// 
// 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/PrecisionTest.java
import org.junit.Test;
import static javafixes.collection.CollectionUtil.newList;
import static javafixes.test.Condition.*;
import static javafixes.test.Random.randomInt;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.not;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail;

package javafixes.math;



public class PrecisionTest {

    @Test
    public void shouldCreatePrecisionWithPositiveValue() {

        assertThat(Precision.of(1).value, equalTo(1));
        assertThat(Precision.precision(1).value, equalTo(1));
        assertThat(Precision.of(Integer.MAX_VALUE).value, equalTo(Integer.MAX_VALUE));
        assertThat(Precision.precision(Integer.MAX_VALUE).value, equalTo(Integer.MAX_VALUE));

        int positiveValue = randomInt(2, Integer.MAX_VALUE - 1);
        assertThat(Precision.of(positiveValue).value, equalTo(positiveValue));
        assertThat(Precision.precision(positiveValue).value, equalTo(positiveValue));
    }

    @Test
    public void shouldFailWhenCreatingZeroDigitPrecision() {
        try {
            Precision.of(0);

            fail("zero precision should fail with IllegalArgumentException");
        } catch (IllegalArgumentException expected) {
            // expected
        }

        try {
            Precision.precision(0);

            fail("zero precision should fail with IllegalArgumentException");
        } catch (IllegalArgumentException expected) {
            // expected
        }
    }

    @Test
    public void shouldFailWhenCreatingNegativeDigitPrecision() {
        for (int value : newList(-1, Integer.MIN_VALUE, randomInt(Integer.MIN_VALUE + 1, -2))) {