chromium/third_party/pdfium/core/fxcrt/code_point_view_unittest.cpp

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

#include "core/fxcrt/code_point_view.h"

#include <string>

#include "build/build_config.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace {

CodePointView;

std::u32string Materialize(CodePointView view) {}

}  // namespace

TEST(CodePointViewTest, Empty) {}

TEST(CodePointViewTest, Basic) {}

TEST(CodePointViewTest, Supplementary) {}

TEST(CodePointViewTest, UnpairedHighSurrogate) {}

TEST(CodePointViewTest, UnpairedLowSurrogate) {}

#if defined(WCHAR_T_IS_16_BIT)
TEST(CodePointViewTest, SurrogateErrorRecovery) {
  EXPECT_EQ(U"(\xd800)", Materialize(CodePointView(L"(\xd800)"))) << "High";
  EXPECT_EQ(U"(\xdc00)", Materialize(CodePointView(L"(\xdc00)"))) << "Low";
  EXPECT_EQ(U"(\xd800🎨)", Materialize(CodePointView(L"(\xd800\xd83c\xdfa8)")))
      << "High-high";
  EXPECT_EQ(U"(🎨\xdc00)", Materialize(CodePointView(L"(\xd83c\xdfa8\xdc00)")))
      << "Low-low";
}
#endif  // defined(WCHAR_T_IS_16_BIT)