Add dr prediction test
[aom.git] / test / divu_small_test.cc
blob064f8ee4541e7dc8fc5a21b73fce76dc79f8a1fa
1 /*
2 * Copyright (c) 2016, Alliance for Open Media. All rights reserved
4 * This source code is subject to the terms of the BSD 2 Clause License and
5 * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
6 * was not distributed with this source code in the LICENSE file, you can
7 * obtain it at www.aomedia.org/license/software. If the Alliance for Open
8 * Media Patent License 1.0 was not distributed with this source code in the
9 * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
12 #include <stdlib.h>
14 #include "third_party/googletest/src/googletest/include/gtest/gtest.h"
16 #include "test/acm_random.h"
17 #include "av1/common/odintrin.h"
19 using libaom_test::ACMRandom;
21 TEST(Daala, TestDIVUuptoMAX) {
22 for (int d = 1; d <= OD_DIVU_DMAX; d++) {
23 for (uint32_t x = 1; x <= 1000000; x++) {
24 GTEST_ASSERT_EQ(x / d, OD_DIVU_SMALL(x, d))
25 << "x=" << x << " d=" << d << " x/d=" << (x / d)
26 << " != " << OD_DIVU_SMALL(x, d);
31 TEST(Daala, TestDIVUrandI31) {
32 ACMRandom rnd(ACMRandom::DeterministicSeed());
33 for (int d = 1; d < OD_DIVU_DMAX; d++) {
34 for (int i = 0; i < 1000000; i++) {
35 uint32_t x = rnd.Rand31();
36 GTEST_ASSERT_EQ(x / d, OD_DIVU_SMALL(x, d))
37 << "x=" << x << " d=" << d << " x/d=" << (x / d)
38 << " != " << OD_DIVU_SMALL(x, d);