38 lines
1.3 KiB
C++
38 lines
1.3 KiB
C++
// Copyright 2022 The Pigweed Authors
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
|
// use this file except in compliance with the License. You may obtain a copy of
|
|
// the License at
|
|
//
|
|
// https://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
// License for the specific language governing permissions and limitations under
|
|
// the License.
|
|
|
|
#include <string_view>
|
|
|
|
#include "pw_bytes/array.h"
|
|
#include "pw_checksum/crc16_ccitt.h"
|
|
#include "pw_perf_test/perf_test.h"
|
|
#include "pw_span/span.h"
|
|
|
|
namespace pw::checksum {
|
|
namespace {
|
|
|
|
constexpr std::string_view kString =
|
|
"In the beginning the Universe was created. This has made a lot of "
|
|
"people very angry and been widely regarded as a bad move.";
|
|
constexpr auto kBytes = bytes::Initialized<1000>([](size_t i) { return i; });
|
|
|
|
PW_PERF_TEST_SIMPLE(CcittCalculationBytes, Crc16Ccitt::Calculate, kBytes);
|
|
|
|
PW_PERF_TEST_SIMPLE(CcittCalculationString,
|
|
Crc16Ccitt::Calculate,
|
|
as_bytes(span(kString)));
|
|
|
|
} // namespace
|
|
} // namespace pw::checksum
|