summaryrefslogtreecommitdiffstats
path: root/media/base/djb2_unittest.cc
blob: f7898aafa3da84fac2af4e5c301db45041eefa3c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// 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 "testing/gtest/include/gtest/gtest.h"

uint8 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);
}