diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-26 00:39:45 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-26 00:39:45 +0000 |
commit | 6dba1dd2efa3ed67bd41312bc682fc12c3c69544 (patch) | |
tree | bfb0bca756ad3e274227d085b82dedda508424fe /rlz/lib/crc32_unittest.cc | |
parent | 4a44f6610eb14a728a22a9dea00d6707d2e616e1 (diff) | |
download | chromium_src-6dba1dd2efa3ed67bd41312bc682fc12c3c69544.zip chromium_src-6dba1dd2efa3ed67bd41312bc682fc12c3c69544.tar.gz chromium_src-6dba1dd2efa3ed67bd41312bc682fc12c3c69544.tar.bz2 |
Revert 144071 - Add a regenerate button to regenerate the password in Windows.
BUG=120480
TEST=Not tested.
Review URL: https://chromiumcodereview.appspot.com/10642009
TBR=zysxqn@google.com
Review URL: https://chromiumcodereview.appspot.com/10659022
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@144074 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'rlz/lib/crc32_unittest.cc')
-rw-r--r-- | rlz/lib/crc32_unittest.cc | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/rlz/lib/crc32_unittest.cc b/rlz/lib/crc32_unittest.cc new file mode 100644 index 0000000..9700058 --- /dev/null +++ b/rlz/lib/crc32_unittest.cc @@ -0,0 +1,52 @@ +// Copyright (c) 2012 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. +// +// A test for ZLib's checksum function. + +#include "rlz/lib/crc32.h" + +#include "base/logging.h" +#include "testing/gmock/include/gmock/gmock.h" +#include "testing/gtest/include/gtest/gtest.h" + +TEST(Crc32Unittest, ByteTest) { + struct { + const char* data; + int len; + // Externally calculated at http://crc32-checksum.waraxe.us/ + int crc; + } kData[] = { + {"Hello" , 5, 0xF7D18982}, + {"Google" , 6, 0x62B0F067}, + {"" , 0, 0x0}, + {"One more string.", 16, 0x0CA14970}, + {NULL , 0, 0x0}, + }; + + for (int i = 0; kData[i].data; i++) + EXPECT_EQ(kData[i].crc, + rlz_lib::Crc32(reinterpret_cast<const unsigned char*>(kData[i].data), + kData[i].len)); +} + +TEST(Crc32Unittest, CharTest) { + struct { + const char* data; + // Externally calculated at http://crc32-checksum.waraxe.us/ + int crc; + } kData[] = { + {"Hello" , 0xF7D18982}, + {"Google" , 0x62B0F067}, + {"" , 0x0}, + {"One more string.", 0x0CA14970}, + {"Google\r\n" , 0x83A3E860}, + {NULL , 0x0}, + }; + + int crc; + for (int i = 0; kData[i].data; i++) { + EXPECT_TRUE(rlz_lib::Crc32(kData[i].data, &crc)); + EXPECT_EQ(kData[i].crc, crc); + } +} |