Java 类com.google.common.hash.HashTestUtils.RandomHasherAction 实例源码

项目:guava-mock    文件:AbstractNonStreamingHashFunctionTest.java   
/**
 * Constructs two trivial HashFunctions (output := input), one streaming and one non-streaming,
 * and checks that their results are identical, no matter which newHasher version we used.
 */
public void testExhaustive() {
  List<Hasher> hashers = ImmutableList.of(
      new StreamingVersion().newHasher(),
      new StreamingVersion().newHasher(52),
      new NonStreamingVersion().newHasher(),
      new NonStreamingVersion().newHasher(123));
  Random random = new Random(0);
  for (int i = 0; i < 200; i++) {
    RandomHasherAction.pickAtRandom(random).performAction(random, hashers);
  }
  HashCode[] codes = new HashCode[hashers.size()];
  for (int i = 0; i < hashers.size(); i++) {
    codes[i] = hashers.get(i).hash();
  }
  for (int i = 1; i < codes.length; i++) {
    assertEquals(codes[i - 1], codes[i]);
  }
}
项目:googles-monorepo-demo    文件:AbstractNonStreamingHashFunctionTest.java   
/**
 * Constructs two trivial HashFunctions (output := input), one streaming and one non-streaming,
 * and checks that their results are identical, no matter which newHasher version we used.
 */
public void testExhaustive() {
  List<Hasher> hashers = ImmutableList.of(
      new StreamingVersion().newHasher(),
      new StreamingVersion().newHasher(52),
      new NonStreamingVersion().newHasher(),
      new NonStreamingVersion().newHasher(123));
  Random random = new Random(0);
  for (int i = 0; i < 200; i++) {
    RandomHasherAction.pickAtRandom(random).performAction(random, hashers);
  }
  HashCode[] codes = new HashCode[hashers.size()];
  for (int i = 0; i < hashers.size(); i++) {
    codes[i] = hashers.get(i).hash();
  }
  for (int i = 1; i < codes.length; i++) {
    assertEquals(codes[i - 1], codes[i]);
  }
}
项目:guava-libraries    文件:AbstractNonStreamingHashFunctionTest.java   
/**
 * Constructs two trivial HashFunctions (output := input), one streaming and one non-streaming,
 * and checks that their results are identical, no matter which newHasher version we used.
 */
public void testExhaustive() {
  List<Hasher> hashers = ImmutableList.of(
      new StreamingVersion().newHasher(),
      new StreamingVersion().newHasher(52),
      new NonStreamingVersion().newHasher(),
      new NonStreamingVersion().newHasher(123));
  Random random = new Random(0);
  for (int i = 0; i < 200; i++) {
    RandomHasherAction.pickAtRandom(random).performAction(random, hashers);
  }
  HashCode[] codes = new HashCode[hashers.size()];
  for (int i = 0; i < hashers.size(); i++) {
    codes[i] = hashers.get(i).hash();
  }
  for (int i = 1; i < codes.length; i++) {
    assertEquals(codes[i - 1], codes[i]);
  }
}
项目:guava    文件:AbstractNonStreamingHashFunctionTest.java   
/**
 * Constructs two trivial HashFunctions (output := input), one streaming and one non-streaming,
 * and checks that their results are identical, no matter which newHasher version we used.
 */
public void testExhaustive() {
  List<Hasher> hashers =
      ImmutableList.of(
          new StreamingVersion().newHasher(),
          new StreamingVersion().newHasher(52),
          new NonStreamingVersion().newHasher(),
          new NonStreamingVersion().newHasher(123));
  Random random = new Random(0);
  for (int i = 0; i < 200; i++) {
    RandomHasherAction.pickAtRandom(random).performAction(random, hashers);
  }
  HashCode[] codes = new HashCode[hashers.size()];
  for (int i = 0; i < hashers.size(); i++) {
    codes[i] = hashers.get(i).hash();
  }
  for (int i = 1; i < codes.length; i++) {
    assertEquals(codes[i - 1], codes[i]);
  }
}
项目:guava    文件:AbstractNonStreamingHashFunctionTest.java   
/**
 * Constructs two trivial HashFunctions (output := input), one streaming and one non-streaming,
 * and checks that their results are identical, no matter which newHasher version we used.
 */
public void testExhaustive() {
  List<Hasher> hashers =
      ImmutableList.of(
          new StreamingVersion().newHasher(),
          new StreamingVersion().newHasher(52),
          new NonStreamingVersion().newHasher(),
          new NonStreamingVersion().newHasher(123));
  Random random = new Random(0);
  for (int i = 0; i < 200; i++) {
    RandomHasherAction.pickAtRandom(random).performAction(random, hashers);
  }
  HashCode[] codes = new HashCode[hashers.size()];
  for (int i = 0; i < hashers.size(); i++) {
    codes[i] = hashers.get(i).hash();
  }
  for (int i = 1; i < codes.length; i++) {
    assertEquals(codes[i - 1], codes[i]);
  }
}