// Path: petitparser-core/src/main/java/org/petitparser/utils/Functions.java
// public static <T> Function<Object, T> constant(T output) {
//   return input -> output;
// }
// 
// Path: petitparser-core/src/main/java/org/petitparser/utils/Functions.java
// public static <T> Function<List<T>, T> firstOfList() {
//   return list -> list.get(0);
// }
// 
// Path: petitparser-core/src/main/java/org/petitparser/utils/Functions.java
// public static <T> Function<List<T>, T> lastOfList() {
//   return list -> list.get(list.size() - 1);
// }
// 
// Path: petitparser-core/src/main/java/org/petitparser/utils/Functions.java
// public static <T> Function<List<T>, T> nthOfList(int index) {
//   return list -> list.get(index < 0 ? list.size() + index : index);
// }
// 
// Path: petitparser-core/src/main/java/org/petitparser/utils/Functions.java
// public static <T> Function<List<T>, List<T>> permutationOfList(
//     int... indexes) {
//   return list -> {
//     List<T> result = new ArrayList<>(indexes.length);
//     for (int index : indexes) {
//       result.add(list.get(index < 0 ? list.size() + index : index));
//     }
//     return result;
//   };
// }
// 
// Path: petitparser-core/src/main/java/org/petitparser/utils/Functions.java
// public static <T> Function<List<T>, List<T>> withoutSeparators() {
//   return list -> {
//     List<T> result = new ArrayList<>();
//     for (int i = 0; i < list.size(); i += 2) {
//       result.add(list.get(i));
//     }
//     return result;
//   };
// }


import static java.util.Arrays.asList;
import static org.junit.Assert.assertEquals;
import static org.petitparser.utils.Functions.constant;
import static org.petitparser.utils.Functions.firstOfList;
import static org.petitparser.utils.Functions.lastOfList;
import static org.petitparser.utils.Functions.nthOfList;
import static org.petitparser.utils.Functions.permutationOfList;
import static org.petitparser.utils.Functions.withoutSeparators;
import org.junit.Test;
import java.util.List;
package org.petitparser.utils;




/**
 * Tests {@link Functions}.
 */
public class FunctionsTest {

  static final List<Object> EMPTY = asList();
  static final List<Object> ONE = asList('a');
  static final List<Object> TWO = asList('a', 'b');
  static final List<Object> THREE = asList('a', 'b', 'c');

  @Test
  public void testFirstOfList() {
    assertEquals('a', firstOfList().apply(ONE));
    assertEquals('a', firstOfList().apply(TWO));
// Path: petitparser-core/src/main/java/org/petitparser/utils/Functions.java
// public static <T> Function<Object, T> constant(T output) {
//   return input -> output;
// }
// 
// Path: petitparser-core/src/main/java/org/petitparser/utils/Functions.java
// public static <T> Function<List<T>, T> firstOfList() {
//   return list -> list.get(0);
// }
// 
// Path: petitparser-core/src/main/java/org/petitparser/utils/Functions.java
// public static <T> Function<List<T>, T> lastOfList() {
//   return list -> list.get(list.size() - 1);
// }
// 
// Path: petitparser-core/src/main/java/org/petitparser/utils/Functions.java
// public static <T> Function<List<T>, T> nthOfList(int index) {
//   return list -> list.get(index < 0 ? list.size() + index : index);
// }
// 
// Path: petitparser-core/src/main/java/org/petitparser/utils/Functions.java
// public static <T> Function<List<T>, List<T>> permutationOfList(
//     int... indexes) {
//   return list -> {
//     List<T> result = new ArrayList<>(indexes.length);
//     for (int index : indexes) {
//       result.add(list.get(index < 0 ? list.size() + index : index));
//     }
//     return result;
//   };
// }
// 
// Path: petitparser-core/src/main/java/org/petitparser/utils/Functions.java
// public static <T> Function<List<T>, List<T>> withoutSeparators() {
//   return list -> {
//     List<T> result = new ArrayList<>();
//     for (int i = 0; i < list.size(); i += 2) {
//       result.add(list.get(i));
//     }
//     return result;
//   };
// }


// Path: petitparser-core/src/test/java/org/petitparser/utils/FunctionsTest.java
import static java.util.Arrays.asList;
import static org.junit.Assert.assertEquals;
import static org.petitparser.utils.Functions.constant;
import static org.petitparser.utils.Functions.firstOfList;
import static org.petitparser.utils.Functions.lastOfList;
import static org.petitparser.utils.Functions.nthOfList;
import static org.petitparser.utils.Functions.permutationOfList;
import static org.petitparser.utils.Functions.withoutSeparators;
import org.junit.Test;
import java.util.List;

package org.petitparser.utils;




/**
 * Tests {@link Functions}.
 */
public class FunctionsTest {

  static final List<Object> EMPTY = asList();
  static final List<Object> ONE = asList('a');
  static final List<Object> TWO = asList('a', 'b');
  static final List<Object> THREE = asList('a', 'b', 'c');

  @Test
  public void testFirstOfList() {
    assertEquals('a', firstOfList().apply(ONE));
    assertEquals('a', firstOfList().apply(TWO));
    assertEquals('a', firstOfList().apply(THREE));