chromium/components/zucchini/rel32_utils_unittest.cc

// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "components/zucchini/rel32_utils.h"

#include <stdint.h>

#include <deque>
#include <memory>
#include <optional>
#include <utility>
#include <vector>

#include "base/test/gtest_util.h"
#include "components/zucchini/address_translator.h"
#include "components/zucchini/arm_utils.h"
#include "components/zucchini/image_utils.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace zucchini {

namespace {

// A trivial AddressTranslator that applies constant shift.
class TestAddressTranslator : public AddressTranslator {};

// Checks that |reader| emits and only emits |expected_refs|, in order.
void CheckReader(const std::vector<Reference>& expected_refs,
                 std::unique_ptr<ReferenceReader> reader) {}

ArmCopyDispFun;

// Copies displacements from |bytes1| to |bytes2| and checks results against
// |bytes_exp_1_to_2|. Then repeats for |*bytes2| , |*byte1|, and
// |bytes_exp_2_to_1|. Empty expected bytes mean failure is expected. The copy
// function is specified by |copier|.
void CheckCopy(const std::vector<uint8_t>& bytes_exp_1_to_2,
               const std::vector<uint8_t>& bytes_exp_2_to_1,
               const std::vector<uint8_t>& bytes1,
               const std::vector<uint8_t>& bytes2,
               ArmCopyDispFun copier) {}

}  // namespace

TEST(Rel32UtilsTest, Rel32ReaderX86) {}

TEST(Rel32UtilsTest, Rel32WriterX86) {}

TEST(Rel32UtilsTest, Rel32ReaderArm_AArch32) {}

TEST(Rel32UtilsTest, Rel32WriterArm_AArch32_Easy) {}

TEST(Rel32UtilsTest, Rel32WriterArm_AArch32_Hard) {}

// Test BLX encoding A2, which is an ARM instruction that switches to THUMB2,
// and therefore should have 2-byte alignment.
TEST(Rel32UtilsTest, AArch32SwitchToThumb2) {}

TEST(Rel32UtilsTest, ArmCopyDisp_AArch32) {}

TEST(Rel32UtilsTest, Rel32ReaderArm_AArch64) {}

TEST(Rel32UtilsTest, Rel32WriterArm_AArch64) {}

TEST(Rel32UtilsTest, ArmCopyDisp_AArch64) {}

}  // namespace zucchini