From e6f8c17ac576651bcb668d0f5e43267ab660b73f Mon Sep 17 00:00:00 2001
From: Geza Lore <gezalore@gmail.com>
Date: Wed, 6 Jul 2016 15:54:29 +0100
Subject: [PATCH] Remove various testing utilities.

test/assertion_helpers.h
test/randomise.{cc,h}
test/snapshot.h

Modfiy blend_mask6_test.cc not to rely on these.

Change-Id: I88b8933fe0a729a606797e5cd421795a544c612d
---
 test/assertion_helpers.h | 278 ------------------------------------
 test/blend_mask6_test.cc | 295 ++++++++++++++++++---------------------
 test/randomise.cc        |  58 --------
 test/randomise.h         | 193 -------------------------
 test/snapshot.h          | 104 --------------
 test/test.mk             |   2 -
 6 files changed, 139 insertions(+), 791 deletions(-)
 delete mode 100644 test/assertion_helpers.h
 delete mode 100644 test/randomise.cc
 delete mode 100644 test/randomise.h
 delete mode 100644 test/snapshot.h

diff --git a/test/assertion_helpers.h b/test/assertion_helpers.h
deleted file mode 100644
index 108c40a949..0000000000
--- a/test/assertion_helpers.h
+++ /dev/null
@@ -1,278 +0,0 @@
-/*
- *  Copyright (c) 2016 The WebM project authors. All Rights Reserved.
- *
- *  Use of this source code is governed by a BSD-style license
- *  that can be found in the LICENSE file in the root of the source
- *  tree. An additional intellectual property rights grant can be found
- *  in the file PATENTS.  All contributing project authors may
- *  be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef TEST_ASSERTION_HELPERS_H_
-#define TEST_ASSERTION_HELPERS_H_
-
-#include "third_party/googletest/src/include/gtest/gtest.h"
-
-namespace libvpx_test {
-namespace assertion_helpers {
-
-// Arrays (1D) are element-wise equal
-template<typename E, size_t n>
-::testing::AssertionResult ArraysEq(const E (&a)[n],
-                                    const E (&b)[n]) {
-  for (size_t i = 0; i < n; i++) {
-    const E &va = a[i];
-    const E &vb = b[i];
-    if (va != vb) {
-      return ::testing::AssertionFailure()
-        << "Arrays do not equal at index "
-        << "[" << i << "]"
-        << " values are: " << va << " vs " << vb;
-    }
-  }
-
-  return ::testing::AssertionSuccess();
-}
-
-// Arrays (1D) are element-wise equal
-// within the index interval [lo, hi)
-template<typename E, size_t n>
-::testing::AssertionResult ArraysEqWithin(const E (&a)[n],
-                                          const E (&b)[n],
-                                          const size_t lo,
-                                          const size_t hi) {
-  assert(hi > lo);
-  assert(hi <= n);
-
-  for (size_t i = lo; i < hi; i++) {
-    const E &va = a[i];
-    const E &vb = b[i];
-    if (va != vb) {
-      return ::testing::AssertionFailure()
-        << "Arrays do not equal at index "
-        << "[" << i << "]"
-        << " values are: " << va << " vs " << vb;
-    }
-  }
-
-  return ::testing::AssertionSuccess();
-}
-
-// Arrays (1D) are element-wise equal
-// outside the index interval [lo, hi)
-template<typename E, size_t n>
-::testing::AssertionResult ArraysEqOutside(const E (&a)[n],
-                                           const E (&b)[n],
-                                           const size_t lo,
-                                           const size_t hi) {
-  assert(hi > lo);
-  assert(hi <= n);
-
-  for (size_t i = 0; i < n; i++) {
-    if (lo <= i && i < hi)
-      continue;
-
-    const E &va = a[i];
-    const E &vb = b[i];
-    if (va != vb) {
-      return ::testing::AssertionFailure()
-        << "Arrays do not equal at index "
-        << "[" << i << "]"
-        << " values are: " << va << " vs " << vb;
-    }
-  }
-
-  return ::testing::AssertionSuccess();
-}
-
-// Arrays (2D) are element-wise equal
-template<typename E, size_t n, size_t m>
-::testing::AssertionResult ArraysEq(const E (&a)[n][m],
-                                    const E (&b)[n][m]) {
-  for (size_t i = 0; i < n; i++) {
-    for (size_t j = 0; j < m; j++) {
-      const E &va = a[i][j];
-      const E &vb = b[i][j];
-      if (va != vb) {
-        return ::testing::AssertionFailure()
-          << "Arrays do not equal at index "
-          << "[" << i << "][" << j << "]"
-          << " values are: " << va << " vs " << vb;
-      }
-    }
-  }
-
-  return ::testing::AssertionSuccess();
-}
-
-// Arrays (2D) are element-wise equal
-// within the index interval [lo0, hi0) x [lo1, hi1) (Cartesian product)
-template<typename E, size_t n, size_t m>
-::testing::AssertionResult ArraysEqWithin(const E (&a)[n][m],
-                                          const E (&b)[n][m],
-                                          const size_t lo0,
-                                          const size_t hi0,
-                                          const size_t lo1,
-                                          const size_t hi1) {
-  assert(hi0 > lo0);
-  assert(hi0 <= n);
-  assert(hi1 > lo1);
-  assert(hi1 <= m);
-
-  for (size_t i = lo0; i < hi0; i++) {
-    for (size_t j = lo1; j < hi1; j++) {
-      const E &va = a[i][j];
-      const E &vb = b[i][j];
-      if (va != vb) {
-        return ::testing::AssertionFailure()
-          << "Arrays do not equal at index "
-          << "[" << i << "][" << j << "]"
-          << " values are: " << va << " vs " << vb;
-      }
-    }
-  }
-
-  return ::testing::AssertionSuccess();
-}
-
-// Arrays (2D) are element-wise equal
-// outside the index interval [lo0, hi0) x [lo1, hi1) (Cartesian product)
-template<typename E, size_t n, size_t m>
-::testing::AssertionResult ArraysEqOutside(const E (&a)[n][m],
-                                           const E (&b)[n][m],
-                                           const size_t lo0,
-                                           const size_t hi0,
-                                           const size_t lo1,
-                                           const size_t hi1) {
-  assert(hi0 > lo0);
-  assert(hi0 <= n);
-  assert(hi1 > lo1);
-  assert(hi1 <= m);
-
-  for (size_t i = 0; i < n; i++) {
-    if (lo0 <= i && i < hi0)
-      continue;
-
-    for (size_t j = 0; j < m; j++) {
-      if (lo1 <= j && j < hi1)
-        continue;
-
-      const E &va = a[i][j];
-      const E &vb = b[i][j];
-      if (va != vb) {
-        return ::testing::AssertionFailure()
-          << "Arrays do not equal at index "
-          << "[" << i << "][" << j << "]"
-          << " values are: " << va << " vs " << vb;
-      }
-    }
-  }
-
-  return ::testing::AssertionSuccess();
-}
-
-// Non contiguous 2D array buffers are element-wise equal
-// at corresponding linear indices specified by rows/cols/stride/offset
-template<typename E, size_t n, size_t m>
-::testing::AssertionResult BuffersEqWithin(const E (&a)[n][m],
-                                           const E (&b)[n][m],
-                                           const size_t stridea,
-                                           const size_t strideb,
-                                           const size_t offseta,
-                                           const size_t offsetb,
-                                           const size_t rows,
-                                           const size_t cols) {
-  assert(rows <= n);
-  assert(cols <= m);
-  assert(stridea <= m);
-  assert(strideb <= m);
-  assert(cols <= stridea);
-  assert(cols <= strideb);
-  assert(offseta < n * m);
-  assert(offsetb < n * m);
-  assert(offseta + (rows - 1) * stridea + (cols - 1) < n * m);
-  assert(offsetb + (rows - 1) * strideb + (cols - 1) < n * m);
-
-  const E *pa = &a[0][0] + offseta;
-  const E *pb = &b[0][0] + offsetb;
-
-  for (size_t r = 0 ; r < rows ; r++) {
-    for (size_t c = 0 ; c < cols ; c++) {
-      const E &va = pa[c];
-      const E &vb = pb[c];
-      if (va != vb) {
-        return ::testing::AssertionFailure()
-          << "Arrays do not equal at linear index "
-          << "[" << pa - &a[0][0]  << "] vs [" << pb - &b[0][0]  << "]"
-          << " row=" << r << " col=" << c
-          << " values are: " << va << " vs " << vb;
-      }
-    }
-    pa += stridea;
-    pb += strideb;
-  }
-
-  return ::testing::AssertionSuccess();
-}
-
-// Non contiguous 2D array buffers are element-wise equal
-// except at corresponding linear indices specified by
-// rows/cols/stride/offset.
-template<typename E, size_t n, size_t m>
-::testing::AssertionResult BuffersEqOutside(const E (&a)[n][m],
-                                            const E (&b)[n][m],
-                                            const size_t stride,
-                                            const size_t offset,
-                                            const size_t rows,
-                                            const size_t cols ) {
-  assert(rows <= n);
-  assert(cols <= m);
-  assert(stride <= m);
-  assert(cols <= stride);
-  assert(offset < n * m);
-  assert(offset + (rows - 1) * stride + (cols - 1) < n * m);
-
-  const E *const pa = &a[0][0];
-  const E *const pb = &b[0][0];
-
-  size_t idx = 0;
-  size_t r = 0;
-  size_t end = offset;  // beginning of first row
-
-  while (idx < n * m) {
-    while (idx < end) {   // until beginning of row or end of buffer
-      const E &va = pa[idx];
-      const E &vb = pb[idx];
-      if (va != vb) {
-        return ::testing::AssertionFailure()
-          << "Arrays do not equal at index "
-          << "[" << idx / m << "][" << idx % m << "]"
-          << " values are: " << va << " vs " << vb;
-      }
-
-      idx++;
-    }
-
-    // Move past row end
-    idx += cols;
-
-    if (++r < rows) {
-      // Move to next row
-      end += stride;
-    } else {
-      // Move to end of buffer
-      end = n * m;
-    }
-  }
-
-  // Sanity check
-  assert(idx == n * m + cols);
-
-  return ::testing::AssertionSuccess();
-}
-
-}   // namespace assertion_helpers
-}   // namespace libvpx_test
-
-#endif  // TEST_ASSERTION_HELPERS_H_
diff --git a/test/blend_mask6_test.cc b/test/blend_mask6_test.cc
index d737dddb5c..6afaad7344 100644
--- a/test/blend_mask6_test.cc
+++ b/test/blend_mask6_test.cc
@@ -16,8 +16,6 @@
 #include "test/register_state_check.h"
 
 #include "test/function_equivalence_test.h"
-#include "test/randomise.h"
-#include "test/snapshot.h"
 
 #include "./vpx_config.h"
 #include "./vpx_dsp_rtcd.h"
@@ -25,15 +23,11 @@
 
 #include "./vp10_rtcd.h"
 
-#include "test/assertion_helpers.h"
+#include "test/acm_random.h"
 #include "vp10/common/enums.h"
 
-using libvpx_test::assertion_helpers::BuffersEqWithin;
-using libvpx_test::assertion_helpers::BuffersEqOutside;
-using libvpx_test::assertion_helpers::ArraysEq;
+using libvpx_test::ACMRandom;
 using libvpx_test::FunctionEquivalenceTest;
-using libvpx_test::Snapshot;
-using libvpx_test::Randomise;
 using std::tr1::make_tuple;
 
 namespace {
@@ -41,118 +35,95 @@ namespace {
 template<typename F, typename T>
 class BlendMask6Test : public FunctionEquivalenceTest<F> {
  protected:
+  static const int kIterations = 10000;
+  static const int kMaxWidth = MAX_SB_SIZE * 5;  // * 5 to cover longer strides
+  static const int kMaxHeight = MAX_SB_SIZE;
+  static const int kBufSize = kMaxWidth * kMaxHeight;
+  static const int kMaxMaskWidth = 2 * MAX_SB_SIZE;
+  static const int kMaxMaskSize = kMaxMaskWidth * kMaxMaskWidth;
+
+  BlendMask6Test() : rng_(ACMRandom::DeterministicSeed()) {}
+
   virtual ~BlendMask6Test() {}
 
   virtual void Execute(T *p_src0, T *p_src1) = 0;
 
   void Common() {
-    w = 1 << randomise.uniform<int>(2, MAX_SB_SIZE_LOG2 + 1);
-    h = 1 << randomise.uniform<int>(2, MAX_SB_SIZE_LOG2 + 1);
+    w_ = 1 << (rng_(MAX_SB_SIZE_LOG2 + 1 - 2) + 2);
+    h_ = 1 << (rng_(MAX_SB_SIZE_LOG2 + 1 - 2) + 2);
 
-    randomise(subx);
-    randomise(suby);
+    subx_ = rng_(2);
+    suby_ = rng_(2);
 
-    randomise(dst_offset, 0, 32);
-    randomise(dst_stride, w, MAX_SB_SIZE * 5 + 1);
+    dst_offset_ = rng_(33);
+    dst_stride_ = rng_(kMaxWidth + 1 - w_) + w_;
 
-    randomise(src0_offset, 0, 32);
-    randomise(src0_stride, w, MAX_SB_SIZE * 5 + 1);
+    src0_offset_ = rng_(33);
+    src0_stride_ = rng_(kMaxWidth + 1 - w_) + w_;
 
-    randomise(src1_offset, 0, 32);
-    randomise(src1_stride, w, MAX_SB_SIZE * 5 + 1);
+    src1_offset_ = rng_(33);
+    src1_stride_ = rng_(kMaxWidth + 1 - w_) + w_;
 
-    randomise(mask_stride, w * (subx ? 2: 1), 2 * MAX_SB_SIZE + 1);
+    mask_stride_ = rng_(kMaxWidth + 1 - w_ * (subx_ ? 2 : 1))
+                  + w_ * (subx_ ? 2 : 1);
 
     T *p_src0;
     T *p_src1;
 
-    switch (randomise.uniform<int>(3)) {
+    switch (rng_(3)) {
       case 0:   // Separate sources
-        p_src0 = &src0[0][0];
-        p_src1 = &src1[0][0];
+        p_src0 = src0_;
+        p_src1 = src1_;
         break;
       case 1:   // src0 == dst
-        p_src0 = &dst_tst[0][0];
-        src0_stride = dst_stride;
-        src0_offset = dst_offset;
-        p_src1 = &src1[0][0];
+        p_src0 = dst_tst_;
+        src0_stride_ = dst_stride_;
+        src0_offset_ = dst_offset_;
+        p_src1 = src1_;
         break;
       case 2:   // src1 == dst
-        p_src0 = &src0[0][0];
-        p_src1 = &dst_tst[0][0];
-        src1_stride = dst_stride;
-        src1_offset = dst_offset;
+        p_src0 = src0_;
+        p_src1 = dst_tst_;
+        src1_stride_ = dst_stride_;
+        src1_offset_ = dst_offset_;
         break;
       default:
         FAIL();
     }
 
-    //////////////////////////////////////////////////////////////////////////
-    // Prepare
-    //////////////////////////////////////////////////////////////////////////
-
-    snapshot(dst_ref);
-    snapshot(dst_tst);
-
-    snapshot(src0);
-    snapshot(src1);
-
-    snapshot(mask);
-
-    //////////////////////////////////////////////////////////////////////////
-    // Execute
-    //////////////////////////////////////////////////////////////////////////
-
     Execute(p_src0, p_src1);
 
-    //////////////////////////////////////////////////////////////////////////
-    // Check
-    //////////////////////////////////////////////////////////////////////////
-
-    ASSERT_TRUE(BuffersEqWithin(dst_ref, dst_tst,
-                                dst_stride, dst_stride,
-                                dst_offset, dst_offset,
-                                h, w));
-
-    ASSERT_TRUE(ArraysEq(snapshot.get(src0), src0));
-    ASSERT_TRUE(ArraysEq(snapshot.get(src1), src1));
-    ASSERT_TRUE(ArraysEq(snapshot.get(mask), mask));
-
-    ASSERT_TRUE(BuffersEqOutside(snapshot.get(dst_ref), dst_ref,
-                                 dst_stride,
-                                 dst_offset,
-                                 h, w));
-
-    ASSERT_TRUE(BuffersEqOutside(snapshot.get(dst_tst), dst_tst,
-                                 dst_stride,
-                                 dst_offset,
-                                 h, w));
+    for (int r = 0 ; r < h_ ; ++r) {
+      for (int c = 0 ; c < w_ ; ++c) {
+        ASSERT_EQ(dst_ref_[dst_offset_ + r * dst_stride_ + c],
+                  dst_tst_[dst_offset_ + r * dst_stride_ + c]);
+      }
+    }
   }
 
-  Snapshot snapshot;
-  Randomise randomise;
+  ACMRandom rng_;
 
-  T dst_ref[MAX_SB_SIZE][MAX_SB_SIZE * 5];
-  T dst_tst[MAX_SB_SIZE][MAX_SB_SIZE * 5];
-  size_t dst_stride;
-  size_t dst_offset;
+  T dst_ref_[kBufSize];
+  T dst_tst_[kBufSize];
+  size_t dst_stride_;
+  size_t dst_offset_;
 
-  T src0[MAX_SB_SIZE][MAX_SB_SIZE * 5];
-  size_t src0_stride;
-  size_t src0_offset;
+  T src0_[kBufSize];
+  size_t src0_stride_;
+  size_t src0_offset_;
 
-  T src1[MAX_SB_SIZE][MAX_SB_SIZE * 5];
-  size_t src1_stride;
-  size_t src1_offset;
+  T src1_[kBufSize];
+  size_t src1_stride_;
+  size_t src1_offset_;
 
-  uint8_t mask[2 * MAX_SB_SIZE][2 * MAX_SB_SIZE];
-  size_t mask_stride;
+  uint8_t mask_[kMaxMaskSize];
+  size_t mask_stride_;
 
-  int w;
-  int h;
+  int w_;
+  int h_;
 
-  bool suby;
-  bool subx;
+  bool suby_;
+  bool subx_;
 };
 
 //////////////////////////////////////////////////////////////////////////////
@@ -168,52 +139,48 @@ typedef void (*F8B)(uint8_t *dst, uint32_t dst_stride,
 class BlendMask6Test8B : public BlendMask6Test<F8B, uint8_t> {
  protected:
   void Execute(uint8_t *p_src0, uint8_t *p_src1) {
-    ref_func_(&dst_ref[0][dst_offset], dst_stride,
-              p_src0 + src0_offset, src0_stride,
-              p_src1 + src1_offset, src1_stride,
-              &mask[0][0], sizeof(mask[0]),
-              h, w, suby, subx);
-
-    ASM_REGISTER_STATE_CHECK(
-      tst_func_(&dst_tst[0][dst_offset], dst_stride,
-                p_src0 + src0_offset, src0_stride,
-                p_src1 + src1_offset, src1_stride,
-                &mask[0][0], sizeof(mask[0]),
-                h, w, suby, subx));
+    ref_func_(dst_ref_ + dst_offset_, dst_stride_,
+              p_src0 + src0_offset_, src0_stride_,
+              p_src1 + src1_offset_, src1_stride_,
+              mask_, kMaxMaskWidth,
+              h_, w_, suby_, subx_);
+
+    tst_func_(dst_tst_ + dst_offset_, dst_stride_,
+              p_src0 + src0_offset_, src0_stride_,
+              p_src1 + src1_offset_, src1_stride_,
+              mask_, kMaxMaskWidth,
+              h_, w_, suby_, subx_);
   }
 };
 
 TEST_P(BlendMask6Test8B, RandomValues) {
-  for (int i = 0 ; i < 10000 && !HasFatalFailure(); i++) {
-    //////////////////////////////////////////////////////////////////////////
-    // Randomise
-    //////////////////////////////////////////////////////////////////////////
+  for (int iter = 0 ; iter < kIterations && !HasFatalFailure(); ++iter) {
+    for (int i = 0 ; i < kBufSize ; ++i) {
+      dst_ref_[i] = rng_.Rand8();
+      dst_tst_[i] = rng_.Rand8();
 
-    randomise(dst_ref);
-    randomise(dst_tst);
-
-    randomise(src0);
-    randomise(src1);
+      src0_[i] = rng_.Rand8();
+      src1_[i] = rng_.Rand8();
+    }
 
-    randomise(mask, 65);
+    for (int i = 0 ; i < kMaxMaskSize ; ++i)
+      mask_[i] = rng_(65);
 
     Common();
   }
 }
 
 TEST_P(BlendMask6Test8B, ExtremeValues) {
-  for (int i = 0 ; i < 1000 && !HasFatalFailure(); i++) {
-    //////////////////////////////////////////////////////////////////////////
-    // Randomise
-    //////////////////////////////////////////////////////////////////////////
-
-    randomise(dst_ref, 254, 256);
-    randomise(dst_tst, 254, 256);
-
-    randomise(src0, 254, 256);
-    randomise(src1, 254, 256);
+  for (int iter = 0 ; iter < kIterations && !HasFatalFailure(); ++iter) {
+    for (int i = 0 ; i < kBufSize ; ++i) {
+      dst_ref_[i] = rng_(2) + 254;
+      dst_tst_[i] = rng_(2) + 254;
+      src0_[i] = rng_(2) + 254;
+      src1_[i] = rng_(2) + 254;
+    }
 
-    randomise(mask, 63, 65);
+    for (int i = 0 ; i < kMaxMaskSize ; ++i)
+      mask_[i] = rng_(2) + 63;
 
     Common();
   }
@@ -239,63 +206,79 @@ typedef void (*FHBD)(uint8_t *dst, uint32_t dst_stride,
 class BlendMask6TestHBD : public BlendMask6Test<FHBD, uint16_t> {
  protected:
   void Execute(uint16_t *p_src0, uint16_t *p_src1) {
-    ref_func_(CONVERT_TO_BYTEPTR(&dst_ref[0][dst_offset]), dst_stride,
-              CONVERT_TO_BYTEPTR(p_src0 + src0_offset), src0_stride,
-              CONVERT_TO_BYTEPTR(p_src1 + src1_offset), src1_stride,
-              &mask[0][0], sizeof(mask[0]),
-              h, w, suby, subx, bit_depth);
+    ref_func_(CONVERT_TO_BYTEPTR(dst_ref_ + dst_offset_), dst_stride_,
+              CONVERT_TO_BYTEPTR(p_src0 + src0_offset_), src0_stride_,
+              CONVERT_TO_BYTEPTR(p_src1 + src1_offset_), src1_stride_,
+              mask_, kMaxMaskWidth,
+              h_, w_, suby_, subx_, bit_depth_);
 
     ASM_REGISTER_STATE_CHECK(
-      tst_func_(CONVERT_TO_BYTEPTR(&dst_tst[0][dst_offset]), dst_stride,
-                CONVERT_TO_BYTEPTR(p_src0 + src0_offset), src0_stride,
-                CONVERT_TO_BYTEPTR(p_src1 + src1_offset), src1_stride,
-                &mask[0][0], sizeof(mask[0]),
-                h, w, suby, subx, bit_depth));
+      tst_func_(CONVERT_TO_BYTEPTR(dst_tst_ + dst_offset_), dst_stride_,
+                CONVERT_TO_BYTEPTR(p_src0 + src0_offset_), src0_stride_,
+                CONVERT_TO_BYTEPTR(p_src1 + src1_offset_), src1_stride_,
+                mask_, kMaxMaskWidth,
+                h_, w_, suby_, subx_, bit_depth_));
   }
 
-  int bit_depth;
+  int bit_depth_;
 };
 
 TEST_P(BlendMask6TestHBD, RandomValues) {
-  for (int i = 0 ; i < 10000 && !HasFatalFailure(); i++) {
-    //////////////////////////////////////////////////////////////////////////
-    // Randomise
-    //////////////////////////////////////////////////////////////////////////
-
-    bit_depth = randomise.choice(8, 10, 12);
-
-    const int hi = 1 << bit_depth;
+  for (int iter = 0 ; iter < kIterations && !HasFatalFailure(); ++iter) {
+    switch (rng_(3)) {
+    case 0:
+      bit_depth_ = 8;
+      break;
+    case 1:
+      bit_depth_ = 10;
+      break;
+    default:
+      bit_depth_ = 12;
+      break;
+    }
 
-    randomise(dst_ref, hi);
-    randomise(dst_tst, hi);
+    const int hi = 1 << bit_depth_;
 
-    randomise(src0, hi);
-    randomise(src1, hi);
+    for (int i = 0 ; i < kBufSize ; ++i) {
+      dst_ref_[i] = rng_(hi);
+      dst_tst_[i] = rng_(hi);
+      src0_[i] = rng_(hi);
+      src1_[i] = rng_(hi);
+    }
 
-    randomise(mask, 65);
+    for (int i = 0 ; i < kMaxMaskSize ; ++i)
+      mask_[i] = rng_(65);
 
     Common();
   }
 }
 
 TEST_P(BlendMask6TestHBD, ExtremeValues) {
-  for (int i = 0 ; i < 1000 && !HasFatalFailure(); i++) {
-    //////////////////////////////////////////////////////////////////////////
-    // Randomise
-    //////////////////////////////////////////////////////////////////////////
-
-    bit_depth = randomise.choice(8, 10, 12);
+  for (int iter = 0 ; iter < 1000 && !HasFatalFailure(); ++iter) {
+    switch (rng_(3)) {
+    case 0:
+      bit_depth_ = 8;
+      break;
+    case 1:
+      bit_depth_ = 10;
+      break;
+    default:
+      bit_depth_ = 12;
+      break;
+    }
 
-    const int hi = 1 << bit_depth;
+    const int hi = 1 << bit_depth_;
     const int lo = hi - 2;
 
-    randomise(dst_ref, lo, hi);
-    randomise(dst_tst, lo, hi);
-
-    randomise(src0, lo, hi);
-    randomise(src1, lo, hi);
+    for (int i = 0 ; i < kBufSize ; ++i) {
+      dst_ref_[i] = rng_(hi - lo) + lo;
+      dst_tst_[i] = rng_(hi - lo) + lo;
+      src0_[i] = rng_(hi - lo) + lo;
+      src1_[i] = rng_(hi - lo) + lo;
+    }
 
-    randomise(mask, 63, 65);
+    for (int i = 0 ; i < kMaxMaskSize ; ++i)
+      mask_[i] = rng_(65);
 
     Common();
   }
diff --git a/test/randomise.cc b/test/randomise.cc
deleted file mode 100644
index 679ee724a7..0000000000
--- a/test/randomise.cc
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- *  Copyright (c) 2016 The WebM project authors. All Rights Reserved.
- *
- *  Use of this source code is governed by a BSD-style license
- *  that can be found in the LICENSE file in the root of the source
- *  tree. An additional intellectual property rights grant can be found
- *  in the file PATENTS.  All contributing project authors may
- *  be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "test/randomise.h"
-
-namespace libvpx_test {
-
-// Add further specialisations as necessary
-
-template<>
-bool Randomise::uniform<bool>() {
-  return rnd_.Rand8() & 1 ? true : false;
-}
-
-template<>
-uint8_t Randomise::uniform<uint8_t>() {
-  return rnd_.Rand8();
-}
-
-template<>
-uint16_t Randomise::uniform<uint16_t>() {
-  return rnd_.Rand16();
-}
-
-template<>
-uint32_t Randomise::uniform<uint32_t>() {
-  const uint32_t l = uniform<uint16_t>();
-  const uint32_t h = uniform<uint16_t>();
-  return h << 16 | l;
-}
-
-template<>
-uint64_t Randomise::uniform<uint64_t>() {
-  const uint64_t l = uniform<uint32_t>();
-  const uint64_t h = uniform<uint32_t>();
-  return h << 32 | l;
-}
-
-template<>
-int8_t Randomise::uniform<int8_t>() { return uniform<uint8_t>(); }
-
-template<>
-int16_t Randomise::uniform<int16_t>() { return uniform<uint16_t>(); }
-
-template<>
-int32_t Randomise::uniform<int32_t>() { return uniform<uint32_t>(); }
-
-template<>
-int64_t Randomise::uniform<int64_t>() { return uniform<uint64_t>(); }
-
-}  // namespace libvpx_test
diff --git a/test/randomise.h b/test/randomise.h
deleted file mode 100644
index c263f84d82..0000000000
--- a/test/randomise.h
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- *  Copyright (c) 2016 The WebM project authors. All Rights Reserved.
- *
- *  Use of this source code is governed by a BSD-style license
- *  that can be found in the LICENSE file in the root of the source
- *  tree. An additional intellectual property rights grant can be found
- *  in the file PATENTS.  All contributing project authors may
- *  be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef TEST_RANDOMISE_H_
-#define TEST_RANDOMISE_H_
-
-#include <stdint.h>
-
-#include <limits>
-
-#include "third_party/googletest/src/include/gtest/gtest.h"
-
-#include "test/acm_random.h"
-
-namespace libvpx_test {
-
-// TODO(any): Replace this when built with C++11
-#define STATIC_ASSERT_INTEGER_TYPE_(T) \
-  GTEST_COMPILE_ASSERT_(std::numeric_limits<T>::is_integer, \
-    integer_type_required);
-
-/**
- * Deterministic random number generator with various convenience methods.
- */
-class Randomise {
- public:
-  Randomise() {
-    rnd_.Reset(ACMRandom::DeterministicSeed());
-  }
-
-  virtual ~Randomise() { }
-
-  // Uniformly distributed random number from the range
-  // [std::numeric_limits<R>::min(), and std::numeric_limits<R>::max()]
-  template<typename R>
-  R uniform() {
-    STATIC_ASSERT_INTEGER_TYPE_(R);
-  }
-
-  // Uniformly distributed random number from the range
-  // [0, hi)
-  template<typename R, typename H>
-  R uniform(H hi) {
-    assert(hi > 0);
-    R v = uniform<R>();
-    if (std::numeric_limits<R>::is_signed && v < 0)
-      return -v % hi;
-    else
-      return v % hi;
-  }
-
-  // Uniformly distributed random number from the range
-  // [lo, hi)
-  template<typename R, typename L, typename H>
-  R uniform(L lo, H hi) {
-    assert(hi > lo);
-    return uniform<R, H>(hi - lo) + lo;
-  }
-
-  // Randomly pick and return one of the arguments
-  template<typename T>
-  T choice(T v0, T v1) {
-    switch (uniform<int>(2)) {
-      case 0: return v0;
-      default: return v1;
-    }
-  }
-
-  // Randomly pick and return one of the arguments
-  template<typename T>
-  T choice(T v0, T v1, T v2) {
-    switch (uniform<int>(3)) {
-      case 0: return v0;
-      case 1: return v1;
-      default: return v2;
-    }
-  }
-
-  template<typename T>
-  void operator()(T &e) {  // NOLINT
-    STATIC_ASSERT_INTEGER_TYPE_(T);
-    e = uniform<T>();
-  }
-
-  template<typename T, typename H>
-  void operator()(T &e, H hi) {  // NOLINT
-    STATIC_ASSERT_INTEGER_TYPE_(T);
-    e = uniform<T, H>(hi);
-  }
-
-  template<typename T, typename L, typename H>
-  void operator()(T &e, L lo, H hi) {  // NOLINT
-    STATIC_ASSERT_INTEGER_TYPE_(T);
-    e = uniform<T, L, H>(lo, hi);
-  }
-
-  template<typename T, size_t n>
-  void operator()(T (&arr)[n]) {
-    STATIC_ASSERT_INTEGER_TYPE_(T);
-    for (size_t i = 0; i < n ; i++) {
-      arr[i] = uniform<T>();
-    }
-  }
-
-  template<typename T, size_t n, typename H>
-  void operator()(T (&arr)[n], H hi) {
-    STATIC_ASSERT_INTEGER_TYPE_(T);
-    for (size_t i = 0; i < n ; i++) {
-      arr[i] = uniform<T, H>(hi);
-    }
-  }
-
-  template<typename T, size_t n, typename L, typename H>
-  void operator()(T (&arr)[n], L lo, H hi) {
-    STATIC_ASSERT_INTEGER_TYPE_(T);
-    for (size_t i = 0; i < n ; i++) {
-      arr[i] = uniform<T, L, H>(lo, hi);
-    }
-  }
-
-  template<typename T, size_t n, size_t m>
-  void operator()(T (&arr)[n][m]) {
-    STATIC_ASSERT_INTEGER_TYPE_(T);
-    for (size_t i = 0; i < n ; i++) {
-      for (size_t j = 0; j < m ; j++) {
-        arr[i][j] = uniform<T>();
-      }
-    }
-  }
-
-  template<typename T, size_t n, size_t m, typename H>
-  void operator()(T (&arr)[n][m], H hi) {
-    STATIC_ASSERT_INTEGER_TYPE_(T);
-    for (size_t i = 0; i < n ; i++) {
-      for (size_t j = 0; j < m ; j++) {
-        arr[i][j] = uniform<T, H>(hi);
-      }
-    }
-  }
-
-  template<typename T, size_t n, size_t m, typename L, typename H>
-  void operator()(T (&arr)[n][m], L lo, H hi) {
-    STATIC_ASSERT_INTEGER_TYPE_(T);
-    for (size_t i = 0; i < n ; i++) {
-      for (size_t j = 0; j < m ; j++) {
-        arr[i][j] = uniform<T, L, H>(lo, hi);
-      }
-    }
-  }
-
- private:
-  libvpx_test::ACMRandom rnd_;
-};
-
-// Add further specialisations as necessary
-
-template<>
-bool Randomise::uniform<bool>();
-
-template<>
-uint8_t Randomise::uniform<uint8_t>();
-
-template<>
-uint16_t Randomise::uniform<uint16_t>();
-
-template<>
-uint32_t Randomise::uniform<uint32_t>();
-
-template<>
-uint64_t Randomise::uniform<uint64_t>();
-
-template<>
-int8_t Randomise::uniform<int8_t>();
-
-template<>
-int16_t Randomise::uniform<int16_t>();
-
-template<>
-int32_t Randomise::uniform<int32_t>();
-
-template<>
-int64_t Randomise::uniform<int64_t>();
-
-}  // namespace libvpx_test
-
-#endif  // TEST_RANDOMISE_H_
diff --git a/test/snapshot.h b/test/snapshot.h
deleted file mode 100644
index b67eddef72..0000000000
--- a/test/snapshot.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- *  Copyright (c) 2016 The WebM project authors. All Rights Reserved.
- *
- *  Use of this source code is governed by a BSD-style license
- *  that can be found in the LICENSE file in the root of the source
- *  tree. An additional intellectual property rights grant can be found
- *  in the file PATENTS.  All contributing project authors may
- *  be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef TEST_SNAPSHOT_H_
-#define TEST_SNAPSHOT_H_
-
-#include <map>
-
-namespace libvpx_test {
-
-/**
- * Allows capturing and retrieving snapshots of arbitrary blobs of memory,
- * blob size is based on compile time type information.
- *
- * Usage:
- * void example() {
- *   Snapshot snapshot;
- *
- *   int foo = 4;
- *
- *   snapshot(foo);
- *
- *   foo = 10;
- *
- *   assert(snapshot.get(foo) == 4);     // Pass
- *   assert(snapshot.get(foo) == foo);   // Fail (4 != 10)
- *
- *   char bar[10][10];
- *   memset(bar, 3, sizeof(bar));
- *
- *   snapshot(bar);
- *
- *   memset(bar, 8, sizeof(bar));
- *
- *   assert(sum(bar) == 800);                 // Pass
- *   assert(sum(snapshot.get(bar)) == 300);   // Pass
- * }
- */
-class Snapshot {
- public:
-  virtual ~Snapshot() {
-    for (snapshot_map_t::iterator it = snapshots_.begin();
-         it != snapshots_.end(); it++) {
-      delete[] it->second;
-    }
-  }
-
-  /**
-   * Take new snapshot for object
-   */
-  template<typename E>
-  void take(const E &e) {
-    const void *const key = reinterpret_cast<const void*>(&e);
-
-    snapshot_map_t::iterator it = snapshots_.find(key);
-
-    if (it != snapshots_.end())
-      delete[] it->second;
-
-    char *const buf = new char[sizeof(E)];
-
-    memcpy(buf, &e, sizeof(E));
-
-    snapshots_[key] = buf;
-  }
-
-  /**
-   * Same as 'take'
-   */
-  template<typename E>
-  void operator()(const E &e) {
-    take(e);
-  }
-
-  /**
-   * Retrieve last snapshot for object
-   */
-  template<typename E>
-  const E& get(const E &e) const {
-    const void *const key = reinterpret_cast<const void*>(&e);
-
-    snapshot_map_t::const_iterator it = snapshots_.find(key);
-
-    assert(it != snapshots_.end());
-
-    return *reinterpret_cast<const E*>(it->second);
-  }
-
- private:
-  typedef std::map<const void*, const char*> snapshot_map_t;
-
-  snapshot_map_t snapshots_;
-};
-
-}   // namespace libvpx_test
-
-#endif  // TEST_SNAPSHOT_H_
diff --git a/test/test.mk b/test/test.mk
index 28612ef857..fcd565c6b5 100644
--- a/test/test.mk
+++ b/test/test.mk
@@ -48,8 +48,6 @@ LIBVPX_TEST_SRCS-yes                   += decode_test_driver.cc
 LIBVPX_TEST_SRCS-yes                   += decode_test_driver.h
 LIBVPX_TEST_SRCS-$(CONFIG_ENCODERS)    += encode_test_driver.cc
 LIBVPX_TEST_SRCS-yes                   += encode_test_driver.h
-LIBVPX_TEST_SRCS-yes                   += randomise.h
-LIBVPX_TEST_SRCS-yes                   += randomise.cc
 
 ## IVF writing.
 LIBVPX_TEST_SRCS-$(CONFIG_ENCODERS)    += ../ivfenc.c ../ivfenc.h
-- 
GitLab