summaryrefslogtreecommitdiffstats
path: root/media/base/djb2_unittest.cc
blob: e44508931205de83a65582fa2c3ff0da6dc68dd2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// Copyright (c) 2008 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "media/base/djb2.h"

#include <stdint.h>

#include "testing/gtest/include/gtest/gtest.h"

uint8_t kTestData[] = {1, 2, 3};

TEST(DJB2HashTest, HashTest) {
  EXPECT_EQ(DJB2Hash(NULL, 0, 0u), 0u);
  EXPECT_EQ(DJB2Hash(kTestData, sizeof(kTestData), 5381u),
                     ((5381u * 33u + 1u) * 33u + 2u) * 33u + 3u);
}