diff options
author | Jett Rink <jettrink@chromium.org> | 2020-11-11 12:22:03 -0700 |
---|---|---|
committer | Rajat Jain <rajatja@google.com> | 2020-11-11 19:36:24 +0000 |
commit | e50f47c5d21c02fdc97d49ad0e207e6185930e6f (patch) | |
tree | cad4a4eba8b513552b98fc5caf436d6f9e59e479 /test/crc.c | |
parent | 90caed85bc8f2c0d2b05b1977e1dd02db614a41b (diff) | |
download | chrome-ec-e50f47c5d21c02fdc97d49ad0e207e6185930e6f.tar.gz |
Revert "crc32: rename test crc32->crc to allow for crc8"
Something slipped through CQ coverage. Need to figure out, but in the
mean time, revert the 3 CLs that seemed to have caused the issue.
BRANCH=none
BUG=chromium:1147953
TEST=none
This reverts commit 5ec269c5a71643c955fe45191ed9f06794c6113a.
Change-Id: I90f812cd4d4f83ea05d34740541db0076abce392
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2533356
Tested-by: Rajat Jain <rajatja@google.com>
Reviewed-by: Tom Hughes <tomhughes@chromium.org>
Diffstat (limited to 'test/crc.c')
-rw-r--r-- | test/crc.c | 75 |
1 files changed, 0 insertions, 75 deletions
diff --git a/test/crc.c b/test/crc.c deleted file mode 100644 index 3521bce4a9..0000000000 --- a/test/crc.c +++ /dev/null @@ -1,75 +0,0 @@ -/* Copyright 2016 The Chromium OS Authors. All rights reserved. - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - * - * Tests crc32 sw implementation. - */ - -#include "common.h" -#include "console.h" -#include "crc.h" -#include "test_util.h" -#include "util.h" - -// test that static version matches context version -static int test_static_version(void) -{ - uint32_t crc; - const uint32_t input = 0xdeadbeef; - - crc32_init(); - crc32_hash32(input); - - crc32_ctx_init(&crc); - crc32_ctx_hash32(&crc, input); - - TEST_ASSERT(crc32_result() == crc32_ctx_result(&crc)); - - return EC_SUCCESS; -} - -// test that context bytes at a time matches static word at time -static int test_8(void) -{ - uint32_t crc; - const uint32_t input = 0xdeadbeef; - const uint8_t *p = (const uint8_t *) &input; - int i; - - crc32_init(); - crc32_hash32(input); - - crc32_ctx_init(&crc); - for (i = 0; i < sizeof(input); ++i) - crc32_ctx_hash8(&crc, p[i]); - - TEST_ASSERT(crc32_result() == crc32_ctx_result(&crc)); - - return EC_SUCCESS; -} - -// http://www.febooti.com/products/filetweak/members/hash-and-crc/test-vectors/ -static int test_kat0(void) -{ - uint32_t crc; - int i; - const char input[] = "The quick brown fox jumps over the lazy dog"; - - crc32_ctx_init(&crc); - for (i = 0; i < strlen(input); ++i) - crc32_ctx_hash8(&crc, input[i]); - TEST_ASSERT(crc32_ctx_result(&crc) == 0x414fa339); - - return EC_SUCCESS; -} - -void run_test(int argc, char **argv) -{ - test_reset(); - - RUN_TEST(test_static_version); - RUN_TEST(test_8); - RUN_TEST(test_kat0); - - test_print_result(); -} |