| // Copyright 2026 Google LLC |
| // |
| // 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 "formats/png/crc.h" |
| |
| #include "gmock/gmock.h" |
| #include "gtest/gtest.h" |
| |
| namespace credentio { |
| namespace { |
| |
| using ::testing::Eq; |
| |
| TEST(PngChunkCrcTest, ComputesCrcCorrectly) { |
| EXPECT_THAT(PngChunkCrc("abcd", "data1"), Eq(0x870ce600)); |
| EXPECT_THAT(PngChunkCrc("dcba", "data1"), Eq(0xf78b39d6)); |
| EXPECT_THAT(PngChunkCrc("dcba", "data2"), Eq(0x6e82686c)); |
| EXPECT_THAT(PngChunkCrc("IDAT", "more data"), Eq(0x6b6f3927)); |
| EXPECT_THAT(PngChunkCrc("IEND", ""), Eq(0xae426082)); |
| } |
| |
| } // namespace |
| } // namespace credentio |