1*a03ca8b9SKrzysztof Kosiński // Copyright 2017 The Chromium Authors. All rights reserved.
2*a03ca8b9SKrzysztof Kosiński // Use of this source code is governed by a BSD-style license that can be
3*a03ca8b9SKrzysztof Kosiński // found in the LICENSE file.
4*a03ca8b9SKrzysztof Kosiński
5*a03ca8b9SKrzysztof Kosiński #include "components/zucchini/image_utils.h"
6*a03ca8b9SKrzysztof Kosiński
7*a03ca8b9SKrzysztof Kosiński #include "testing/gtest/include/gtest/gtest.h"
8*a03ca8b9SKrzysztof Kosiński
9*a03ca8b9SKrzysztof Kosiński namespace zucchini {
10*a03ca8b9SKrzysztof Kosiński
TEST(ImageUtilsTest,Bitness)11*a03ca8b9SKrzysztof Kosiński TEST(ImageUtilsTest, Bitness) {
12*a03ca8b9SKrzysztof Kosiński EXPECT_EQ(4U, WidthOf(kBit32));
13*a03ca8b9SKrzysztof Kosiński EXPECT_EQ(8U, WidthOf(kBit64));
14*a03ca8b9SKrzysztof Kosiński }
15*a03ca8b9SKrzysztof Kosiński
TEST(ImageUtilsTest,CastExecutableTypeToString)16*a03ca8b9SKrzysztof Kosiński TEST(ImageUtilsTest, CastExecutableTypeToString) {
17*a03ca8b9SKrzysztof Kosiński EXPECT_EQ("NoOp", CastExecutableTypeToString(kExeTypeNoOp));
18*a03ca8b9SKrzysztof Kosiński EXPECT_EQ("Px86", CastExecutableTypeToString(kExeTypeWin32X86));
19*a03ca8b9SKrzysztof Kosiński EXPECT_EQ("EA64", CastExecutableTypeToString(kExeTypeElfAArch64));
20*a03ca8b9SKrzysztof Kosiński EXPECT_EQ("DEX ", CastExecutableTypeToString(kExeTypeDex));
21*a03ca8b9SKrzysztof Kosiński }
22*a03ca8b9SKrzysztof Kosiński
TEST(ImageUtilsTest,ElementMatchToString)23*a03ca8b9SKrzysztof Kosiński TEST(ImageUtilsTest, ElementMatchToString) {
24*a03ca8b9SKrzysztof Kosiński constexpr ExecutableType kAnyType = kExeTypeWin32X86;
25*a03ca8b9SKrzysztof Kosiński EXPECT_EQ("1+2=3+4",
26*a03ca8b9SKrzysztof Kosiński (ElementMatch{{{1, 2}, kAnyType}, {{3, 4}, kAnyType}}).ToString());
27*a03ca8b9SKrzysztof Kosiński EXPECT_EQ(
28*a03ca8b9SKrzysztof Kosiński "1000000000+1=0+1000000000",
29*a03ca8b9SKrzysztof Kosiński (ElementMatch{{{1000000000, 1}, kAnyType}, {{0, 1000000000}, kAnyType}})
30*a03ca8b9SKrzysztof Kosiński .ToString());
31*a03ca8b9SKrzysztof Kosiński }
32*a03ca8b9SKrzysztof Kosiński
33*a03ca8b9SKrzysztof Kosiński } // namespace zucchini
34