chromium/third_party/puffin/src/patching_unittest.cc

// Copyright 2017 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.

#include <string>
#include <vector>

#include "base/files/file_util.h"
#include "base/path_service.h"
#include "gtest/gtest.h"

#include "puffin/memory_stream.h"
#include "puffin/src/include/puffin/common.h"
#include "puffin/src/include/puffin/puffdiff.h"
#include "puffin/src/include/puffin/puffpatch.h"
#include "puffin/src/include/puffin/utils.h"
#include "puffin/src/logging.h"
#include "puffin/src/puffin_stream.h"
#include "puffin/src/unittest_common.h"

#define PRINT_SAMPLE

string;
vector;

namespace puffin {

namespace {

base::FilePath out_test_file(const char* file) {}

#if PRINT_SAMPLE
// Print an array into hex-format to the output. This can be used to create
// static arrays for unit testing of the puffer/huffer.
void PrintArray(const string& name, const Buffer& array) {
  std::cout << "const Buffer " << name << " = {" << std::endl << " ";
  for (size_t idx = 0; idx < array.size(); idx++) {
    std::cout << " 0x" << std::hex << std::uppercase << std::setfill('0')
              << std::setw(2) << (unsigned int)(array[idx]);
    if (idx == array.size() - 1) {
      std::cout << std::dec << "};" << std::endl;
      return;
    }
    std::cout << ",";
    if ((idx + 1) % 12 == 0) {
      std::cout << std::endl << " ";
    }
  }
}
#endif

const Buffer kPatch1To2 =;

const Buffer kPatch2To1 =;

const Buffer kPatch1ToNoDeflate =;

}  // namespace

void TestPatching(const Buffer& src_buf,
                  const Buffer& dst_buf,
                  const vector<BitExtent>& src_deflates,
                  const vector<BitExtent>& dst_deflates,
                  const Buffer patch) {}

TEST(PatchingTest, Patching1To2Test) {}

TEST(PatchingTest, Patching2To1Test) {}

TEST(PatchingTest, Patching1ToNoDeflateTest) {}

TEST(PatchingTest, ApplyPuffPatchTest) {}

TEST(PatchingTest, PuffDiffTest) {}

// TODO(ahassani): add tests for:
//   TestPatchingNoDeflateTo2

// TODO(ahassani): Change tests data if you decided to compress the header of
// the patch.

}  // namespace puffin