text: // Copyright (C) 2020 T. Zachary Laine
  //
  // Distributed under the Boost Software License, Version 1.0. (See
  // accompanying file LICENSE_1_0.txt or copy at
  // http://www.boost.org/LICENSE_1_0.txt)
  
  // Warning! This file is autogenerated.
  #include <boost/text/bidirectional.hpp>
  
  #include "bidi_tests.hpp"
  
  #include <gtest/gtest.h>
  
  #include <algorithm>
  
  
  TEST(bidi_character, bidi_character_125_000)
  {
  
      {
          // line 87501
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x2681, 0x0062, 0x005B, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 2, 2, 2, 2, 2, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 2, 3, 4, 5, 6, 7, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87502
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x2681, 0x005B, 0x0062, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87503
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x2681, 0x005B, 0x0062, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 2, 2, 2, 2, 2, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 2, 3, 4, 5, 6, 7, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87504
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x2681, 0x005B, 0x0029, 0x0062, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87505
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x2681, 0x005B, 0x0029, 0x0062, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 2, 2, 2, 2, 2, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 2, 3, 4, 5, 6, 7, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87506
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x2681, 0x005B, 0x0029, 0x005D, 0x0062 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87507
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x2681, 0x005B, 0x0029, 0x005D, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 2, 2, 2, 2, 2, 2 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 2, 3, 4, 5, 6, 7, 8, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87508
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x005B, 0x2681, 0x0062, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87509
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x005B, 0x2681, 0x0062, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 2, 2, 2, 2, 2, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 2, 3, 4, 5, 6, 7, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87510
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x005B, 0x2681, 0x0029, 0x0062, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  }
  
  TEST(bidi_character, bidi_character_125_001)
  {
  
      {
          // line 87511
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x005B, 0x2681, 0x0029, 0x0062, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 2, 2, 2, 2, 2, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 2, 3, 4, 5, 6, 7, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87512
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x005B, 0x2681, 0x0029, 0x005D, 0x0062 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87513
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x005B, 0x2681, 0x0029, 0x005D, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 2, 2, 2, 2, 2, 2 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 2, 3, 4, 5, 6, 7, 8, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87514
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x005B, 0x0029, 0x2681, 0x0062, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87515
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x005B, 0x0029, 0x2681, 0x0062, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 2, 2, 2, 2, 2, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 2, 3, 4, 5, 6, 7, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87516
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x005B, 0x0029, 0x2681, 0x005D, 0x0062 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87517
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x005B, 0x0029, 0x2681, 0x005D, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 2, 2, 2, 2, 2, 2 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 2, 3, 4, 5, 6, 7, 8, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87518
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x005B, 0x0029, 0x005D, 0x2681, 0x0062 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87519
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x005B, 0x0029, 0x005D, 0x2681, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 2, 2, 2, 2, 2, 2 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 2, 3, 4, 5, 6, 7, 8, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87520
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x2681, 0x0062, 0x005B, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  }
  
  TEST(bidi_character, bidi_character_125_002)
  {
  
      {
          // line 87521
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x2681, 0x0062, 0x005B, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 2, 2, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 3, 4, 5, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87522
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x2681, 0x005B, 0x0062, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87523
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x2681, 0x005B, 0x0062, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 2, 2, 2, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 3, 4, 5, 6, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87524
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x2681, 0x005B, 0x0029, 0x0062, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87525
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x2681, 0x005B, 0x0029, 0x0062, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 1, 2, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87526
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x2681, 0x005B, 0x0029, 0x005D, 0x0062 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87527
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x2681, 0x005B, 0x0029, 0x005D, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 1, 1, 2 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87528
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x005B, 0x2681, 0x0062, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87529
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x005B, 0x2681, 0x0062, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 2, 2, 2, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 3, 4, 5, 6, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87530
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x005B, 0x2681, 0x0029, 0x0062, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  }
  
  TEST(bidi_character, bidi_character_125_003)
  {
  
      {
          // line 87531
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x005B, 0x2681, 0x0029, 0x0062, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 1, 2, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87532
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x005B, 0x2681, 0x0029, 0x005D, 0x0062 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87533
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x005B, 0x2681, 0x0029, 0x005D, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 1, 1, 2 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87534
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x005B, 0x0029, 0x2681, 0x0062, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87535
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x005B, 0x0029, 0x2681, 0x0062, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 1, 2, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87536
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x005B, 0x0029, 0x2681, 0x005D, 0x0062 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87537
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x005B, 0x0029, 0x2681, 0x005D, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 1, 1, 2 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87538
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x005B, 0x0029, 0x005D, 0x2681, 0x0062 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87539
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x005B, 0x0029, 0x005D, 0x2681, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 1, 1, 2 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87540
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x005B, 0x0061, 0x2681, 0x0062, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  }
  
  TEST(bidi_character, bidi_character_125_004)
  {
  
      {
          // line 87541
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x005B, 0x0061, 0x2681, 0x0062, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 2, 2, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 4, 5, 6, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87542
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x005B, 0x0061, 0x2681, 0x0029, 0x0062, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87543
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x005B, 0x0061, 0x2681, 0x0029, 0x0062, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 1, 2, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87544
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x005B, 0x0061, 0x2681, 0x0029, 0x005D, 0x0062 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87545
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x005B, 0x0061, 0x2681, 0x0029, 0x005D, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 1, 1, 2 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87546
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x005B, 0x0061, 0x0029, 0x2681, 0x0062, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87547
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x005B, 0x0061, 0x0029, 0x2681, 0x0062, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 1, 2, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87548
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x005B, 0x0061, 0x0029, 0x2681, 0x005D, 0x0062 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87549
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x005B, 0x0061, 0x0029, 0x2681, 0x005D, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 1, 1, 2 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87550
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x005B, 0x0061, 0x0029, 0x005D, 0x2681, 0x0062 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  }
  
  TEST(bidi_character, bidi_character_125_005)
  {
  
      {
          // line 87551
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x005B, 0x0061, 0x0029, 0x005D, 0x2681, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 1, 1, 2 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87552
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x005B, 0x0029, 0x0061, 0x2681, 0x0062, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87553
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x005B, 0x0029, 0x0061, 0x2681, 0x0062, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 1, 2, 2, 2, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 5, 6, 7, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87554
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x005B, 0x0029, 0x0061, 0x2681, 0x005D, 0x0062 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87555
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x005B, 0x0029, 0x0061, 0x2681, 0x005D, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 1, 2, 2, 2, 2 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 5, 6, 7, 8, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87556
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x005B, 0x0029, 0x0061, 0x005D, 0x2681, 0x0062 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87557
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x005B, 0x0029, 0x0061, 0x005D, 0x2681, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 1, 2, 2, 2, 2 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 5, 6, 7, 8, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87558
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x2681, 0x0062, 0x005B, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87559
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x2681, 0x0062, 0x005B, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 2, 2, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 3, 4, 5, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87560
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x2681, 0x005B, 0x0062, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  }
  
  TEST(bidi_character, bidi_character_125_006)
  {
  
      {
          // line 87561
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x2681, 0x005B, 0x0062, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 2, 2, 2, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 3, 4, 5, 6, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87562
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x2681, 0x005B, 0x0029, 0x0062, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87563
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x2681, 0x005B, 0x0029, 0x0062, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 1, 2, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87564
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x2681, 0x005B, 0x0029, 0x005D, 0x0062 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87565
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x2681, 0x005B, 0x0029, 0x005D, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 1, 1, 2 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87566
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x005B, 0x2681, 0x0062, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87567
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x005B, 0x2681, 0x0062, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 2, 2, 2, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 3, 4, 5, 6, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87568
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x005B, 0x2681, 0x0029, 0x0062, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87569
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x005B, 0x2681, 0x0029, 0x0062, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 1, 2, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87570
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x005B, 0x2681, 0x0029, 0x005D, 0x0062 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  }
  
  TEST(bidi_character, bidi_character_125_007)
  {
  
      {
          // line 87571
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x005B, 0x2681, 0x0029, 0x005D, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 1, 1, 2 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87572
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x005B, 0x0029, 0x2681, 0x0062, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87573
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x005B, 0x0029, 0x2681, 0x0062, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 1, 2, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87574
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x005B, 0x0029, 0x2681, 0x005D, 0x0062 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87575
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x005B, 0x0029, 0x2681, 0x005D, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 1, 1, 2 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87576
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x005B, 0x0029, 0x005D, 0x2681, 0x0062 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87577
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x005B, 0x0029, 0x005D, 0x2681, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 1, 1, 2 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87578
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x005B, 0x0061, 0x2681, 0x0062, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87579
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x005B, 0x0061, 0x2681, 0x0062, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 2, 2, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 4, 5, 6, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87580
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x005B, 0x0061, 0x2681, 0x0029, 0x0062, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  }
  
  TEST(bidi_character, bidi_character_125_008)
  {
  
      {
          // line 87581
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x005B, 0x0061, 0x2681, 0x0029, 0x0062, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 1, 2, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87582
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x005B, 0x0061, 0x2681, 0x0029, 0x005D, 0x0062 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87583
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x005B, 0x0061, 0x2681, 0x0029, 0x005D, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 1, 1, 2 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87584
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x005B, 0x0061, 0x0029, 0x2681, 0x0062, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87585
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x005B, 0x0061, 0x0029, 0x2681, 0x0062, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 1, 2, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87586
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x005B, 0x0061, 0x0029, 0x2681, 0x005D, 0x0062 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87587
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x005B, 0x0061, 0x0029, 0x2681, 0x005D, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 1, 1, 2 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87588
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x005B, 0x0061, 0x0029, 0x005D, 0x2681, 0x0062 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87589
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x005B, 0x0061, 0x0029, 0x005D, 0x2681, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 1, 1, 2 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87590
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x005B, 0x0029, 0x0061, 0x2681, 0x0062, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  }
  
  TEST(bidi_character, bidi_character_125_009)
  {
  
      {
          // line 87591
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x005B, 0x0029, 0x0061, 0x2681, 0x0062, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 1, 2, 2, 2, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 5, 6, 7, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87592
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x005B, 0x0029, 0x0061, 0x2681, 0x005D, 0x0062 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87593
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x005B, 0x0029, 0x0061, 0x2681, 0x005D, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 1, 2, 2, 2, 2 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 5, 6, 7, 8, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87594
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x005B, 0x0029, 0x0061, 0x005D, 0x2681, 0x0062 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87595
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x005B, 0x0029, 0x0061, 0x005D, 0x2681, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 1, 2, 2, 2, 2 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 5, 6, 7, 8, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87596
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x005B, 0x2680, 0x0061, 0x2681, 0x0062, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87597
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x005B, 0x2680, 0x0061, 0x2681, 0x0062, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 2, 2, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 4, 5, 6, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87598
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x005B, 0x2680, 0x0061, 0x2681, 0x0029, 0x0062, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87599
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x005B, 0x2680, 0x0061, 0x2681, 0x0029, 0x0062, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 1, 2, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87600
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x005B, 0x2680, 0x0061, 0x2681, 0x0029, 0x005D, 0x0062 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  }
  
  TEST(bidi_character, bidi_character_125_010)
  {
  
      {
          // line 87601
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x005B, 0x2680, 0x0061, 0x2681, 0x0029, 0x005D, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 1, 1, 2 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87602
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x005B, 0x2680, 0x0061, 0x0029, 0x2681, 0x0062, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87603
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x005B, 0x2680, 0x0061, 0x0029, 0x2681, 0x0062, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 1, 2, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87604
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x005B, 0x2680, 0x0061, 0x0029, 0x2681, 0x005D, 0x0062 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87605
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x005B, 0x2680, 0x0061, 0x0029, 0x2681, 0x005D, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 1, 1, 2 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87606
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x005B, 0x2680, 0x0061, 0x0029, 0x005D, 0x2681, 0x0062 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87607
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x005B, 0x2680, 0x0061, 0x0029, 0x005D, 0x2681, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 1, 1, 2 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87608
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x005B, 0x2680, 0x0029, 0x0061, 0x2681, 0x0062, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87609
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x005B, 0x2680, 0x0029, 0x0061, 0x2681, 0x0062, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 1, 2, 2, 2, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 5, 6, 7, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87610
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x005B, 0x2680, 0x0029, 0x0061, 0x2681, 0x005D, 0x0062 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  }
  
  TEST(bidi_character, bidi_character_125_011)
  {
  
      {
          // line 87611
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x005B, 0x2680, 0x0029, 0x0061, 0x2681, 0x005D, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 1, 2, 2, 2, 2 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 5, 6, 7, 8, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87612
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x005B, 0x2680, 0x0029, 0x0061, 0x005D, 0x2681, 0x0062 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87613
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x005B, 0x2680, 0x0029, 0x0061, 0x005D, 0x2681, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 1, 2, 2, 2, 2 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 5, 6, 7, 8, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87614
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x005B, 0x0029, 0x2680, 0x0061, 0x2681, 0x0062, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87615
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x005B, 0x0029, 0x2680, 0x0061, 0x2681, 0x0062, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 1, 2, 2, 2, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 5, 6, 7, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87616
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x005B, 0x0029, 0x2680, 0x0061, 0x2681, 0x005D, 0x0062 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87617
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x005B, 0x0029, 0x2680, 0x0061, 0x2681, 0x005D, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 1, 2, 2, 2, 2 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 5, 6, 7, 8, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87618
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x005B, 0x0029, 0x2680, 0x0061, 0x005D, 0x2681, 0x0062 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87619
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x005B, 0x0029, 0x2680, 0x0061, 0x005D, 0x2681, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 1, 2, 2, 2, 2 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 5, 6, 7, 8, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87622
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x2681, 0x05D0, 0x0028, 0x005B, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 1, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  }
  
  TEST(bidi_character, bidi_character_125_012)
  {
  
      {
          // line 87623
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x2681, 0x05D0, 0x0028, 0x005B, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 1, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87624
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x2681, 0x0028, 0x05D0, 0x005B, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 1, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87625
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x2681, 0x0028, 0x05D0, 0x005B, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 1, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87626
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x2681, 0x0028, 0x005B, 0x05D0, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 1, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87627
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x2681, 0x0028, 0x005B, 0x05D0, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 1, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87628
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x2681, 0x0028, 0x005B, 0x0029, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 1, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87629
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x2681, 0x0028, 0x005B, 0x0029, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 1, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87630
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x2681, 0x0028, 0x005B, 0x0029, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87631
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x2681, 0x0028, 0x005B, 0x0029, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 1, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87632
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x2681, 0x05D0, 0x005B, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 1, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  }
  
  TEST(bidi_character, bidi_character_125_013)
  {
  
      {
          // line 87633
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x2681, 0x05D0, 0x005B, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 1, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87634
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x2681, 0x005B, 0x05D0, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 1, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87635
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x2681, 0x005B, 0x05D0, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 1, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87636
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x2681, 0x005B, 0x0029, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 1, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87637
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x2681, 0x005B, 0x0029, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 1, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87638
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x2681, 0x005B, 0x0029, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87639
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x2681, 0x005B, 0x0029, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 1, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87640
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x005B, 0x2681, 0x05D0, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 1, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87641
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x005B, 0x2681, 0x05D0, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 1, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87642
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x005B, 0x2681, 0x0029, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 1, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  }
  
  TEST(bidi_character, bidi_character_125_014)
  {
  
      {
          // line 87643
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x005B, 0x2681, 0x0029, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 1, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87644
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x005B, 0x2681, 0x0029, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87645
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x005B, 0x2681, 0x0029, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 1, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87646
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x005B, 0x0029, 0x2681, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 1, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87647
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x005B, 0x0029, 0x2681, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 1, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87648
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x005B, 0x0029, 0x2681, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87649
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x005B, 0x0029, 0x2681, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 1, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87650
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x005B, 0x0029, 0x005D, 0x2681, 0x05D0 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87651
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x005B, 0x0029, 0x005D, 0x2681, 0x05D0 };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 1, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87652
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x2681, 0x05D0, 0x005B, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 1, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  }
  
  TEST(bidi_character, bidi_character_125_015)
  {
  
      {
          // line 87653
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x2681, 0x05D0, 0x005B, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87654
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x2681, 0x005B, 0x05D0, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 1, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87655
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x2681, 0x005B, 0x05D0, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87656
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x2681, 0x005B, 0x0029, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 1, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87657
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x2681, 0x005B, 0x0029, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87658
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x2681, 0x005B, 0x0029, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87659
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x2681, 0x005B, 0x0029, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87660
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x005B, 0x2681, 0x05D0, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 1, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87661
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x005B, 0x2681, 0x05D0, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87662
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x005B, 0x2681, 0x0029, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 1, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  }
  
  TEST(bidi_character, bidi_character_125_016)
  {
  
      {
          // line 87663
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x005B, 0x2681, 0x0029, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87664
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x005B, 0x2681, 0x0029, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87665
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x005B, 0x2681, 0x0029, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87666
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x005B, 0x0029, 0x2681, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 1, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87667
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x005B, 0x0029, 0x2681, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87668
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x005B, 0x0029, 0x2681, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87669
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x005B, 0x0029, 0x2681, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87670
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x005B, 0x0029, 0x005D, 0x2681, 0x05D0 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87671
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x005B, 0x0029, 0x005D, 0x2681, 0x05D0 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87672
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x005B, 0x0061, 0x2681, 0x05D0, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 1, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  }
  
  TEST(bidi_character, bidi_character_125_017)
  {
  
      {
          // line 87673
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x005B, 0x0061, 0x2681, 0x05D0, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87674
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x005B, 0x0061, 0x2681, 0x0029, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 1, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87675
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x005B, 0x0061, 0x2681, 0x0029, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87676
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x005B, 0x0061, 0x2681, 0x0029, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87677
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x005B, 0x0061, 0x2681, 0x0029, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87678
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x005B, 0x0061, 0x0029, 0x2681, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 1, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87679
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x005B, 0x0061, 0x0029, 0x2681, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87680
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x005B, 0x0061, 0x0029, 0x2681, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87681
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x005B, 0x0061, 0x0029, 0x2681, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87682
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x005B, 0x0061, 0x0029, 0x005D, 0x2681, 0x05D0 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  }
  
  TEST(bidi_character, bidi_character_125_018)
  {
  
      {
          // line 87683
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x005B, 0x0061, 0x0029, 0x005D, 0x2681, 0x05D0 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87684
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x005B, 0x0029, 0x0061, 0x2681, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 1, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87685
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x005B, 0x0029, 0x0061, 0x2681, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 1, 2, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87686
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x005B, 0x0029, 0x0061, 0x2681, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87687
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x005B, 0x0029, 0x0061, 0x2681, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 1, 2, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87688
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x005B, 0x0029, 0x0061, 0x005D, 0x2681, 0x05D0 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87689
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x005B, 0x0029, 0x0061, 0x005D, 0x2681, 0x05D0 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 1, 2, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87690
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x2681, 0x05D0, 0x0028, 0x005B, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 1, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87691
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x2681, 0x05D0, 0x0028, 0x005B, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 1, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87692
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x2681, 0x0028, 0x05D0, 0x005B, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 1, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  }
  
  TEST(bidi_character, bidi_character_125_019)
  {
  
      {
          // line 87693
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x2681, 0x0028, 0x05D0, 0x005B, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 1, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87694
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x2681, 0x0028, 0x005B, 0x05D0, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 1, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87695
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x2681, 0x0028, 0x005B, 0x05D0, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 1, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87696
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x2681, 0x0028, 0x005B, 0x0029, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 1, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87697
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x2681, 0x0028, 0x005B, 0x0029, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 1, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87698
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x2681, 0x0028, 0x005B, 0x0029, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87699
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x2681, 0x0028, 0x005B, 0x0029, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 1, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87700
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x2681, 0x05D0, 0x005B, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 1, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87701
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x2681, 0x05D0, 0x005B, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 1, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87702
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x2681, 0x005B, 0x05D0, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 1, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  }
  
  TEST(bidi_character, bidi_character_125_020)
  {
  
      {
          // line 87703
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x2681, 0x005B, 0x05D0, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 1, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87704
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x2681, 0x005B, 0x0029, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 1, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87705
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x2681, 0x005B, 0x0029, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 1, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87706
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x2681, 0x005B, 0x0029, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87707
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x2681, 0x005B, 0x0029, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 1, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87708
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x005B, 0x2681, 0x05D0, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 1, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87709
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x005B, 0x2681, 0x05D0, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 1, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87710
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x005B, 0x2681, 0x0029, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 1, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87711
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x005B, 0x2681, 0x0029, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 1, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87712
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x005B, 0x2681, 0x0029, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  }
  
  TEST(bidi_character, bidi_character_125_021)
  {
  
      {
          // line 87713
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x005B, 0x2681, 0x0029, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 1, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87714
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x005B, 0x0029, 0x2681, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 1, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87715
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x005B, 0x0029, 0x2681, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 1, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87716
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x005B, 0x0029, 0x2681, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87717
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x005B, 0x0029, 0x2681, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 1, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87718
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x005B, 0x0029, 0x005D, 0x2681, 0x05D0 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87719
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x005B, 0x0029, 0x005D, 0x2681, 0x05D0 };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 1, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87720
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x2681, 0x05D0, 0x005B, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 1, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87721
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x2681, 0x05D0, 0x005B, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87722
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x2681, 0x005B, 0x05D0, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 1, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  }
  
  TEST(bidi_character, bidi_character_125_022)
  {
  
      {
          // line 87723
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x2681, 0x005B, 0x05D0, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87724
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x2681, 0x005B, 0x0029, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 1, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87725
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x2681, 0x005B, 0x0029, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87726
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x2681, 0x005B, 0x0029, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87727
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x2681, 0x005B, 0x0029, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87728
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x005B, 0x2681, 0x05D0, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 1, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87729
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x005B, 0x2681, 0x05D0, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87730
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x005B, 0x2681, 0x0029, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 1, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87731
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x005B, 0x2681, 0x0029, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87732
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x005B, 0x2681, 0x0029, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  }
  
  TEST(bidi_character, bidi_character_125_023)
  {
  
      {
          // line 87733
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x005B, 0x2681, 0x0029, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87734
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x005B, 0x0029, 0x2681, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 1, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87735
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x005B, 0x0029, 0x2681, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87736
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x005B, 0x0029, 0x2681, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87737
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x005B, 0x0029, 0x2681, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87738
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x005B, 0x0029, 0x005D, 0x2681, 0x05D0 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87739
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x005B, 0x0029, 0x005D, 0x2681, 0x05D0 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87740
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x005B, 0x0061, 0x2681, 0x05D0, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 1, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87741
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x005B, 0x0061, 0x2681, 0x05D0, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87742
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x005B, 0x0061, 0x2681, 0x0029, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 1, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  }
  
  TEST(bidi_character, bidi_character_125_024)
  {
  
      {
          // line 87743
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x005B, 0x0061, 0x2681, 0x0029, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87744
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x005B, 0x0061, 0x2681, 0x0029, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87745
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x005B, 0x0061, 0x2681, 0x0029, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87746
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x005B, 0x0061, 0x0029, 0x2681, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 1, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87747
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x005B, 0x0061, 0x0029, 0x2681, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87748
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x005B, 0x0061, 0x0029, 0x2681, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87749
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x005B, 0x0061, 0x0029, 0x2681, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87750
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x005B, 0x0061, 0x0029, 0x005D, 0x2681, 0x05D0 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87751
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x005B, 0x0061, 0x0029, 0x005D, 0x2681, 0x05D0 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87752
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x005B, 0x0029, 0x0061, 0x2681, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 1, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  }
  
  TEST(bidi_character, bidi_character_125_025)
  {
  
      {
          // line 87753
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x005B, 0x0029, 0x0061, 0x2681, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 1, 2, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87754
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x005B, 0x0029, 0x0061, 0x2681, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87755
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x005B, 0x0029, 0x0061, 0x2681, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 1, 2, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87756
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x005B, 0x0029, 0x0061, 0x005D, 0x2681, 0x05D0 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87757
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x005B, 0x0029, 0x0061, 0x005D, 0x2681, 0x05D0 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 1, 2, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87758
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x2681, 0x05D0, 0x005B, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 1, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87759
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x2681, 0x05D0, 0x005B, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87760
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x2681, 0x005B, 0x05D0, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 1, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87761
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x2681, 0x005B, 0x05D0, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87762
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x2681, 0x005B, 0x0029, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 1, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  }
  
  TEST(bidi_character, bidi_character_125_026)
  {
  
      {
          // line 87763
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x2681, 0x005B, 0x0029, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87764
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x2681, 0x005B, 0x0029, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87765
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x2681, 0x005B, 0x0029, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87766
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x005B, 0x2681, 0x05D0, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 1, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87767
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x005B, 0x2681, 0x05D0, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87768
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x005B, 0x2681, 0x0029, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 1, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87769
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x005B, 0x2681, 0x0029, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87770
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x005B, 0x2681, 0x0029, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87771
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x005B, 0x2681, 0x0029, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87772
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x005B, 0x0029, 0x2681, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 1, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  }
  
  TEST(bidi_character, bidi_character_125_027)
  {
  
      {
          // line 87773
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x005B, 0x0029, 0x2681, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87774
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x005B, 0x0029, 0x2681, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87775
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x005B, 0x0029, 0x2681, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87776
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x005B, 0x0029, 0x005D, 0x2681, 0x05D0 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87777
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x005B, 0x0029, 0x005D, 0x2681, 0x05D0 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87778
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x005B, 0x0061, 0x2681, 0x05D0, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 1, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87779
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x005B, 0x0061, 0x2681, 0x05D0, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87780
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x005B, 0x0061, 0x2681, 0x0029, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 1, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87781
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x005B, 0x0061, 0x2681, 0x0029, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87782
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x005B, 0x0061, 0x2681, 0x0029, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  }
  
  TEST(bidi_character, bidi_character_125_028)
  {
  
      {
          // line 87783
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x005B, 0x0061, 0x2681, 0x0029, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87784
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x005B, 0x0061, 0x0029, 0x2681, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 1, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87785
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x005B, 0x0061, 0x0029, 0x2681, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87786
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x005B, 0x0061, 0x0029, 0x2681, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87787
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x005B, 0x0061, 0x0029, 0x2681, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87788
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x005B, 0x0061, 0x0029, 0x005D, 0x2681, 0x05D0 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87789
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x005B, 0x0061, 0x0029, 0x005D, 0x2681, 0x05D0 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87790
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x005B, 0x0029, 0x0061, 0x2681, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 1, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87791
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x005B, 0x0029, 0x0061, 0x2681, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 1, 2, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87792
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x005B, 0x0029, 0x0061, 0x2681, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  }
  
  TEST(bidi_character, bidi_character_125_029)
  {
  
      {
          // line 87793
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x005B, 0x0029, 0x0061, 0x2681, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 1, 2, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87794
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x005B, 0x0029, 0x0061, 0x005D, 0x2681, 0x05D0 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87795
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x005B, 0x0029, 0x0061, 0x005D, 0x2681, 0x05D0 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 1, 2, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87796
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x005B, 0x2680, 0x0061, 0x2681, 0x05D0, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 1, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87797
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x005B, 0x2680, 0x0061, 0x2681, 0x05D0, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87798
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x005B, 0x2680, 0x0061, 0x2681, 0x0029, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 1, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87799
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x005B, 0x2680, 0x0061, 0x2681, 0x0029, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87800
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x005B, 0x2680, 0x0061, 0x2681, 0x0029, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87801
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x005B, 0x2680, 0x0061, 0x2681, 0x0029, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87802
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x005B, 0x2680, 0x0061, 0x0029, 0x2681, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 1, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  }
  
  TEST(bidi_character, bidi_character_125_030)
  {
  
      {
          // line 87803
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x005B, 0x2680, 0x0061, 0x0029, 0x2681, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87804
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x005B, 0x2680, 0x0061, 0x0029, 0x2681, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87805
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x005B, 0x2680, 0x0061, 0x0029, 0x2681, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87806
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x005B, 0x2680, 0x0061, 0x0029, 0x005D, 0x2681, 0x05D0 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87807
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x005B, 0x2680, 0x0061, 0x0029, 0x005D, 0x2681, 0x05D0 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87808
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x005B, 0x2680, 0x0029, 0x0061, 0x2681, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 1, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87809
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x005B, 0x2680, 0x0029, 0x0061, 0x2681, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 1, 2, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87810
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x005B, 0x2680, 0x0029, 0x0061, 0x2681, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87811
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x005B, 0x2680, 0x0029, 0x0061, 0x2681, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 1, 2, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87812
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x005B, 0x2680, 0x0029, 0x0061, 0x005D, 0x2681, 0x05D0 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  }
  
  TEST(bidi_character, bidi_character_125_031)
  {
  
      {
          // line 87813
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x005B, 0x2680, 0x0029, 0x0061, 0x005D, 0x2681, 0x05D0 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 1, 2, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87814
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x005B, 0x0029, 0x2680, 0x0061, 0x2681, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 1, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87815
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x005B, 0x0029, 0x2680, 0x0061, 0x2681, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 1, 2, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87816
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x005B, 0x0029, 0x2680, 0x0061, 0x2681, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87817
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x005B, 0x0029, 0x2680, 0x0061, 0x2681, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 1, 2, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87818
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x005B, 0x0029, 0x2680, 0x0061, 0x005D, 0x2681, 0x05D0 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87819
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x005B, 0x0029, 0x2680, 0x0061, 0x005D, 0x2681, 0x05D0 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 1, 2, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87822
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x0062, 0x2681, 0x005B, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87823
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x0062, 0x2681, 0x005B, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 2, 2, 2, 2, 2, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 2, 3, 4, 5, 6, 7, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87824
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x0062, 0x005B, 0x2681, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  }
  
  TEST(bidi_character, bidi_character_125_032)
  {
  
      {
          // line 87825
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x0062, 0x005B, 0x2681, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 2, 2, 2, 2, 2, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 2, 3, 4, 5, 6, 7, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87826
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x0062, 0x005B, 0x0029, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87827
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x0062, 0x005B, 0x0029, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 2, 2, 2, 2, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 2, 3, 4, 5, 6, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87828
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x0062, 0x005B, 0x0029, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87829
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x0062, 0x005B, 0x0029, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 2, 2, 2, 2, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 2, 3, 4, 5, 6, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87830
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x005B, 0x0062, 0x2681, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87831
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x005B, 0x0062, 0x2681, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 2, 2, 2, 2, 2, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 2, 3, 4, 5, 6, 7, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87832
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x005B, 0x0062, 0x0029, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87833
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x005B, 0x0062, 0x0029, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 2, 2, 2, 2, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 2, 3, 4, 5, 6, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87834
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x005B, 0x0062, 0x0029, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  }
  
  TEST(bidi_character, bidi_character_125_033)
  {
  
      {
          // line 87835
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x005B, 0x0062, 0x0029, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 2, 2, 2, 2, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 2, 3, 4, 5, 6, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87836
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x005B, 0x0029, 0x0062, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87837
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x005B, 0x0029, 0x0062, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 2, 2, 2, 2, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 2, 3, 4, 5, 6, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87838
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x005B, 0x0029, 0x0062, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87839
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x005B, 0x0029, 0x0062, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 2, 2, 2, 2, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 2, 3, 4, 5, 6, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87840
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x005B, 0x0062, 0x2681, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87841
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x005B, 0x0062, 0x2681, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 2, 2, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 3, 4, 5, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87842
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x005B, 0x0062, 0x0029, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87843
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x005B, 0x0062, 0x0029, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 2, 2, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 3, 4, 5, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87844
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x005B, 0x0062, 0x0029, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  }
  
  TEST(bidi_character, bidi_character_125_034)
  {
  
      {
          // line 87845
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x005B, 0x0062, 0x0029, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 2, 2, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 3, 4, 5, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87846
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x005B, 0x0029, 0x0062, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87847
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x005B, 0x0029, 0x0062, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 2, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87848
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x005B, 0x0029, 0x0062, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87849
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x005B, 0x0029, 0x0062, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 2, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87850
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x005B, 0x0061, 0x0029, 0x0062, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87851
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x005B, 0x0061, 0x0029, 0x0062, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 2, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87852
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x005B, 0x0061, 0x0029, 0x0062, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87853
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x005B, 0x0061, 0x0029, 0x0062, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 2, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87854
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x0062, 0x2681, 0x005B, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  }
  
  TEST(bidi_character, bidi_character_125_035)
  {
  
      {
          // line 87855
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x0062, 0x2681, 0x005B, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 2, 2, 2, 2, 2, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 2, 3, 4, 5, 6, 7, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87856
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x0062, 0x005B, 0x2681, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87857
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x0062, 0x005B, 0x2681, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 2, 2, 2, 2, 2, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 2, 3, 4, 5, 6, 7, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87858
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x0062, 0x005B, 0x0029, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87859
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x0062, 0x005B, 0x0029, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 2, 2, 2, 2, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 2, 3, 4, 5, 6, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87860
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x0062, 0x005B, 0x0029, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87861
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x0062, 0x005B, 0x0029, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 2, 2, 2, 2, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 2, 3, 4, 5, 6, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87862
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x005B, 0x0062, 0x2681, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87863
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x005B, 0x0062, 0x2681, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 2, 2, 2, 2, 2, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 2, 3, 4, 5, 6, 7, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87864
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x005B, 0x0062, 0x0029, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  }
  
  TEST(bidi_character, bidi_character_125_036)
  {
  
      {
          // line 87865
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x005B, 0x0062, 0x0029, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 2, 2, 2, 2, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 2, 3, 4, 5, 6, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87866
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x005B, 0x0062, 0x0029, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87867
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x005B, 0x0062, 0x0029, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 2, 2, 2, 2, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 2, 3, 4, 5, 6, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87868
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x005B, 0x0029, 0x0062, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87869
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x005B, 0x0029, 0x0062, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 2, 2, 2, 2, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 2, 3, 4, 5, 6, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87870
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x005B, 0x0029, 0x0062, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87871
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x005B, 0x0029, 0x0062, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 2, 2, 2, 2, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 2, 3, 4, 5, 6, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87872
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x005B, 0x0062, 0x2681, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87873
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x005B, 0x0062, 0x2681, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 2, 2, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 3, 4, 5, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87874
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x005B, 0x0062, 0x0029, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  }
  
  TEST(bidi_character, bidi_character_125_037)
  {
  
      {
          // line 87875
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x005B, 0x0062, 0x0029, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 2, 2, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 3, 4, 5, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87876
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x005B, 0x0062, 0x0029, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87877
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x005B, 0x0062, 0x0029, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 2, 2, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 3, 4, 5, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87878
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x005B, 0x0029, 0x0062, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87879
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x005B, 0x0029, 0x0062, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 2, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87880
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x005B, 0x0029, 0x0062, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87881
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x005B, 0x0029, 0x0062, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 2, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87882
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x005B, 0x0061, 0x0029, 0x0062, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87883
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x005B, 0x0061, 0x0029, 0x0062, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 2, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87884
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x005B, 0x0061, 0x0029, 0x0062, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  }
  
  TEST(bidi_character, bidi_character_125_038)
  {
  
      {
          // line 87885
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x005B, 0x0061, 0x0029, 0x0062, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 2, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87886
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x005B, 0x0062, 0x2681, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87887
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x005B, 0x0062, 0x2681, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 2, 2, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 3, 4, 5, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87888
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x005B, 0x0062, 0x0029, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87889
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x005B, 0x0062, 0x0029, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 2, 2, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 3, 4, 5, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87890
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x005B, 0x0062, 0x0029, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87891
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x005B, 0x0062, 0x0029, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 2, 2, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 3, 4, 5, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87892
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x005B, 0x0029, 0x0062, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87893
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x005B, 0x0029, 0x0062, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 2, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87894
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x005B, 0x0029, 0x0062, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  }
  
  TEST(bidi_character, bidi_character_125_039)
  {
  
      {
          // line 87895
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x005B, 0x0029, 0x0062, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 2, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87896
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x005B, 0x0061, 0x0029, 0x0062, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87897
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x005B, 0x0061, 0x0029, 0x0062, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 2, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87898
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x005B, 0x0061, 0x0029, 0x0062, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87899
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x005B, 0x0061, 0x0029, 0x0062, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 2, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87900
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x005B, 0x2680, 0x0061, 0x0029, 0x0062, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87901
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x005B, 0x2680, 0x0061, 0x0029, 0x0062, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 2, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87902
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x005B, 0x2680, 0x0061, 0x0029, 0x0062, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87903
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x005B, 0x2680, 0x0061, 0x0029, 0x0062, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 2, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87906
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x0062, 0x005B, 0x0063, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  }
  
  TEST(bidi_character, bidi_character_125_040)
  {
  
      {
          // line 87907
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x0062, 0x005B, 0x0063, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 2, 2, 2, 2, 2, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 2, 3, 4, 5, 6, 7, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87908
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x0062, 0x005B, 0x0029, 0x0063, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87909
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x0062, 0x005B, 0x0029, 0x0063, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 2, 2, 2, 2, 2, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 2, 3, 4, 5, 6, 7, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87910
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x0062, 0x005B, 0x0029, 0x005D, 0x0063 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87911
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x0062, 0x005B, 0x0029, 0x005D, 0x0063 };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 2, 2, 2, 2, 2, 2 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 2, 3, 4, 5, 6, 7, 8, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87912
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x005B, 0x0062, 0x0029, 0x0063, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87913
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x005B, 0x0062, 0x0029, 0x0063, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 2, 2, 2, 2, 2, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 2, 3, 4, 5, 6, 7, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87914
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x005B, 0x0062, 0x0029, 0x005D, 0x0063 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87915
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x005B, 0x0062, 0x0029, 0x005D, 0x0063 };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 2, 2, 2, 2, 2, 2 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 2, 3, 4, 5, 6, 7, 8, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87916
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x005B, 0x0029, 0x0062, 0x005D, 0x0063 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  }
  
  TEST(bidi_character, bidi_character_125_041)
  {
  
      {
          // line 87917
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x005B, 0x0029, 0x0062, 0x005D, 0x0063 };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 2, 2, 2, 2, 2, 2 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 2, 3, 4, 5, 6, 7, 8, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87918
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x005B, 0x0062, 0x0029, 0x0063, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87919
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x005B, 0x0062, 0x0029, 0x0063, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 2, 2, 1, 2, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 3, 4, 5, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87920
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x005B, 0x0062, 0x0029, 0x005D, 0x0063 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87921
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x005B, 0x0062, 0x0029, 0x005D, 0x0063 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 2, 2, 1, 1, 2 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 3, 4, 5, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87922
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x005B, 0x0029, 0x0062, 0x005D, 0x0063 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87923
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x005B, 0x0029, 0x0062, 0x005D, 0x0063 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 2, 2, 2 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 6, 7, 8, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87924
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x005B, 0x0061, 0x0029, 0x0062, 0x005D, 0x0063 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87925
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x005B, 0x0061, 0x0029, 0x0062, 0x005D, 0x0063 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 2, 2, 2 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 6, 7, 8, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87926
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x0062, 0x005B, 0x0063, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  }
  
  TEST(bidi_character, bidi_character_125_042)
  {
  
      {
          // line 87927
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x0062, 0x005B, 0x0063, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 2, 2, 2, 2, 2, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 2, 3, 4, 5, 6, 7, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87928
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x0062, 0x005B, 0x0029, 0x0063, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87929
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x0062, 0x005B, 0x0029, 0x0063, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 2, 2, 2, 2, 2, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 2, 3, 4, 5, 6, 7, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87930
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x0062, 0x005B, 0x0029, 0x005D, 0x0063 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87931
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x0062, 0x005B, 0x0029, 0x005D, 0x0063 };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 2, 2, 2, 2, 2, 2 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 2, 3, 4, 5, 6, 7, 8, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87932
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x005B, 0x0062, 0x0029, 0x0063, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87933
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x005B, 0x0062, 0x0029, 0x0063, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 2, 2, 2, 2, 2, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 2, 3, 4, 5, 6, 7, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87934
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x005B, 0x0062, 0x0029, 0x005D, 0x0063 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87935
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x005B, 0x0062, 0x0029, 0x005D, 0x0063 };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 2, 2, 2, 2, 2, 2 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 2, 3, 4, 5, 6, 7, 8, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87936
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x005B, 0x0029, 0x0062, 0x005D, 0x0063 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  }
  
  TEST(bidi_character, bidi_character_125_043)
  {
  
      {
          // line 87937
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x005B, 0x0029, 0x0062, 0x005D, 0x0063 };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 2, 2, 2, 2, 2, 2 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 2, 3, 4, 5, 6, 7, 8, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87938
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x005B, 0x0062, 0x0029, 0x0063, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87939
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x005B, 0x0062, 0x0029, 0x0063, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 2, 2, 1, 2, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 3, 4, 5, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87940
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x005B, 0x0062, 0x0029, 0x005D, 0x0063 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87941
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x005B, 0x0062, 0x0029, 0x005D, 0x0063 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 2, 2, 1, 1, 2 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 3, 4, 5, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87942
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x005B, 0x0029, 0x0062, 0x005D, 0x0063 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87943
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x005B, 0x0029, 0x0062, 0x005D, 0x0063 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 2, 2, 2 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 6, 7, 8, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87944
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x005B, 0x0061, 0x0029, 0x0062, 0x005D, 0x0063 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87945
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x005B, 0x0061, 0x0029, 0x0062, 0x005D, 0x0063 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 2, 2, 2 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 6, 7, 8, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87946
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x005B, 0x0062, 0x0029, 0x0063, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  }
  
  TEST(bidi_character, bidi_character_125_044)
  {
  
      {
          // line 87947
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x005B, 0x0062, 0x0029, 0x0063, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 2, 2, 1, 2, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 3, 4, 5, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87948
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x005B, 0x0062, 0x0029, 0x005D, 0x0063 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87949
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x005B, 0x0062, 0x0029, 0x005D, 0x0063 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 2, 2, 1, 1, 2 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 3, 4, 5, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87950
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x005B, 0x0029, 0x0062, 0x005D, 0x0063 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87951
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x005B, 0x0029, 0x0062, 0x005D, 0x0063 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 2, 2, 2 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 6, 7, 8, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87952
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x005B, 0x0061, 0x0029, 0x0062, 0x005D, 0x0063 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87953
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x005B, 0x0061, 0x0029, 0x0062, 0x005D, 0x0063 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 2, 2, 2 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 6, 7, 8, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87954
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x005B, 0x2680, 0x0061, 0x0029, 0x0062, 0x005D, 0x0063 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87955
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x005B, 0x2680, 0x0061, 0x0029, 0x0062, 0x005D, 0x0063 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 2, 2, 2 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 6, 7, 8, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87958
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x0062, 0x05D0, 0x005B, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 1, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  }
  
  TEST(bidi_character, bidi_character_125_045)
  {
  
      {
          // line 87959
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x0062, 0x05D0, 0x005B, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 1, 2, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87960
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x0062, 0x005B, 0x05D0, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 1, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87961
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x0062, 0x005B, 0x05D0, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 1, 2, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87962
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x0062, 0x005B, 0x0029, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 1, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87963
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x0062, 0x005B, 0x0029, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 2, 2, 2, 2, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 2, 3, 4, 5, 6, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87964
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x0062, 0x005B, 0x0029, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87965
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x0062, 0x005B, 0x0029, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 2, 2, 2, 2, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 2, 3, 4, 5, 6, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87966
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x005B, 0x0062, 0x05D0, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 1, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87967
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x005B, 0x0062, 0x05D0, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 1, 1, 2, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87968
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x005B, 0x0062, 0x0029, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 1, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  }
  
  TEST(bidi_character, bidi_character_125_046)
  {
  
      {
          // line 87969
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x005B, 0x0062, 0x0029, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 2, 2, 2, 2, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 2, 3, 4, 5, 6, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87970
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x005B, 0x0062, 0x0029, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87971
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x005B, 0x0062, 0x0029, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 2, 2, 2, 2, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 2, 3, 4, 5, 6, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87972
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x005B, 0x0029, 0x0062, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 1, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87973
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x005B, 0x0029, 0x0062, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 2, 2, 2, 2, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 2, 3, 4, 5, 6, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87974
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x005B, 0x0029, 0x0062, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87975
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x005B, 0x0029, 0x0062, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 2, 2, 2, 2, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 2, 3, 4, 5, 6, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87976
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x005B, 0x0062, 0x05D0, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 1, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87977
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x005B, 0x0062, 0x05D0, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 2, 2, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 3, 4, 5, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87978
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x005B, 0x0062, 0x0029, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 1, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  }
  
  TEST(bidi_character, bidi_character_125_047)
  {
  
      {
          // line 87979
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x005B, 0x0062, 0x0029, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 2, 2, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 3, 4, 5, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87980
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x005B, 0x0062, 0x0029, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87981
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x005B, 0x0062, 0x0029, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 2, 2, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 3, 4, 5, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87982
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x005B, 0x0029, 0x0062, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 1, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87983
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x005B, 0x0029, 0x0062, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 2, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87984
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x005B, 0x0029, 0x0062, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87985
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x005B, 0x0029, 0x0062, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 2, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87986
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x005B, 0x0061, 0x0029, 0x0062, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 1, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87987
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x005B, 0x0061, 0x0029, 0x0062, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 2, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87988
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x005B, 0x0061, 0x0029, 0x0062, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  }
  
  TEST(bidi_character, bidi_character_125_048)
  {
  
      {
          // line 87989
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x005B, 0x0061, 0x0029, 0x0062, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 2, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87990
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x0062, 0x05D0, 0x005B, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 1, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87991
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x0062, 0x05D0, 0x005B, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 1, 2, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87992
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x0062, 0x005B, 0x05D0, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 1, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87993
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x0062, 0x005B, 0x05D0, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 1, 2, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87994
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x0062, 0x005B, 0x0029, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 1, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87995
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x0062, 0x005B, 0x0029, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 2, 2, 2, 2, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 2, 3, 4, 5, 6, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87996
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x0062, 0x005B, 0x0029, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87997
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x0062, 0x005B, 0x0029, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 2, 2, 2, 2, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 2, 3, 4, 5, 6, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 87998
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x005B, 0x0062, 0x05D0, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 1, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  }
  
  TEST(bidi_character, bidi_character_125_049)
  {
  
      {
          // line 87999
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x005B, 0x0062, 0x05D0, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 1, 1, 2, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88000
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x005B, 0x0062, 0x0029, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 1, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88001
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x005B, 0x0062, 0x0029, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 2, 2, 2, 2, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 2, 3, 4, 5, 6, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88002
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x005B, 0x0062, 0x0029, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88003
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x005B, 0x0062, 0x0029, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 2, 2, 2, 2, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 2, 3, 4, 5, 6, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88004
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x005B, 0x0029, 0x0062, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 1, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88005
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x005B, 0x0029, 0x0062, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 2, 2, 2, 2, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 2, 3, 4, 5, 6, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88006
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x005B, 0x0029, 0x0062, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88007
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x005B, 0x0029, 0x0062, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 2, 2, 2, 2, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 2, 3, 4, 5, 6, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88008
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x005B, 0x0062, 0x05D0, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 1, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  }
  
  TEST(bidi_character, bidi_character_125_050)
  {
  
      {
          // line 88009
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x005B, 0x0062, 0x05D0, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 2, 2, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 3, 4, 5, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88010
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x005B, 0x0062, 0x0029, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 1, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88011
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x005B, 0x0062, 0x0029, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 2, 2, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 3, 4, 5, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88012
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x005B, 0x0062, 0x0029, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88013
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x005B, 0x0062, 0x0029, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 2, 2, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 3, 4, 5, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88014
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x005B, 0x0029, 0x0062, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 1, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88015
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x005B, 0x0029, 0x0062, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 2, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88016
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x005B, 0x0029, 0x0062, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88017
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x005B, 0x0029, 0x0062, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 2, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88018
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x005B, 0x0061, 0x0029, 0x0062, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 1, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  }
  
  TEST(bidi_character, bidi_character_125_051)
  {
  
      {
          // line 88019
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x005B, 0x0061, 0x0029, 0x0062, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 2, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88020
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x005B, 0x0061, 0x0029, 0x0062, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88021
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x005B, 0x0061, 0x0029, 0x0062, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 2, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88022
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x005B, 0x0062, 0x05D0, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 1, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88023
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x005B, 0x0062, 0x05D0, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 2, 2, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 3, 4, 5, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88024
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x005B, 0x0062, 0x0029, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 1, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88025
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x005B, 0x0062, 0x0029, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 2, 2, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 3, 4, 5, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88026
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x005B, 0x0062, 0x0029, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88027
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x005B, 0x0062, 0x0029, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 2, 2, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 3, 4, 5, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88028
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x005B, 0x0029, 0x0062, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 1, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  }
  
  TEST(bidi_character, bidi_character_125_052)
  {
  
      {
          // line 88029
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x005B, 0x0029, 0x0062, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 2, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88030
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x005B, 0x0029, 0x0062, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88031
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x005B, 0x0029, 0x0062, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 2, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88032
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x005B, 0x0061, 0x0029, 0x0062, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 1, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88033
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x005B, 0x0061, 0x0029, 0x0062, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 2, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88034
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x005B, 0x0061, 0x0029, 0x0062, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88035
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x005B, 0x0061, 0x0029, 0x0062, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 2, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88036
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x005B, 0x2680, 0x0061, 0x0029, 0x0062, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 1, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88037
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x005B, 0x2680, 0x0061, 0x0029, 0x0062, 0x05D0, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 2, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88038
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x005B, 0x2680, 0x0061, 0x0029, 0x0062, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  }
  
  TEST(bidi_character, bidi_character_125_053)
  {
  
      {
          // line 88039
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x005B, 0x2680, 0x0061, 0x0029, 0x0062, 0x005D, 0x05D0 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 2, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88042
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x05D0, 0x2681, 0x0028, 0x005B, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 1, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88043
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x05D0, 0x2681, 0x0028, 0x005B, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 1, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88044
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x05D0, 0x0028, 0x2681, 0x005B, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 1, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88045
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x05D0, 0x0028, 0x2681, 0x005B, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 1, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88046
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x05D0, 0x0028, 0x005B, 0x2681, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 1, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88047
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x05D0, 0x0028, 0x005B, 0x2681, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 1, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88048
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x05D0, 0x0028, 0x005B, 0x0029, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 1, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88049
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x05D0, 0x0028, 0x005B, 0x0029, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 1, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88050
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x05D0, 0x0028, 0x005B, 0x0029, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 1, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  }
  
  TEST(bidi_character, bidi_character_125_054)
  {
  
      {
          // line 88051
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x05D0, 0x0028, 0x005B, 0x0029, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 1, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88052
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x05D0, 0x2681, 0x005B, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 1, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88053
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x05D0, 0x2681, 0x005B, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 1, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88054
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x05D0, 0x005B, 0x2681, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 1, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88055
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x05D0, 0x005B, 0x2681, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 1, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88056
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x05D0, 0x005B, 0x0029, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 1, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88057
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x05D0, 0x005B, 0x0029, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 1, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88058
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x05D0, 0x005B, 0x0029, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 1, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88059
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x05D0, 0x005B, 0x0029, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 1, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88060
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x005B, 0x05D0, 0x2681, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 1, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  }
  
  TEST(bidi_character, bidi_character_125_055)
  {
  
      {
          // line 88061
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x005B, 0x05D0, 0x2681, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 1, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88062
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x005B, 0x05D0, 0x0029, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 1, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88063
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x005B, 0x05D0, 0x0029, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 1, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88064
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x005B, 0x05D0, 0x0029, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 1, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88065
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x005B, 0x05D0, 0x0029, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 1, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88066
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x005B, 0x0029, 0x05D0, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 1, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88067
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x005B, 0x0029, 0x05D0, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 1, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88068
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x005B, 0x0029, 0x05D0, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 1, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88069
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x005B, 0x0029, 0x05D0, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 1, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88070
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x05D0, 0x2681, 0x005B, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 1, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  }
  
  TEST(bidi_character, bidi_character_125_056)
  {
  
      {
          // line 88071
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x05D0, 0x2681, 0x005B, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88072
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x05D0, 0x005B, 0x2681, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 1, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88073
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x05D0, 0x005B, 0x2681, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88074
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x05D0, 0x005B, 0x0029, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 1, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88075
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x05D0, 0x005B, 0x0029, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88076
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x05D0, 0x005B, 0x0029, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 1, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88077
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x05D0, 0x005B, 0x0029, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88078
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x005B, 0x05D0, 0x2681, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 1, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88079
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x005B, 0x05D0, 0x2681, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88080
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x005B, 0x05D0, 0x0029, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 1, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  }
  
  TEST(bidi_character, bidi_character_125_057)
  {
  
      {
          // line 88081
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x005B, 0x05D0, 0x0029, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88082
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x005B, 0x05D0, 0x0029, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 1, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88083
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x005B, 0x05D0, 0x0029, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88084
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x005B, 0x0029, 0x05D0, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 1, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88085
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x005B, 0x0029, 0x05D0, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88086
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x005B, 0x0029, 0x05D0, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 1, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88087
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x005B, 0x0029, 0x05D0, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88088
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x005B, 0x0061, 0x05D0, 0x2681, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 1, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88089
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x005B, 0x0061, 0x05D0, 0x2681, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88090
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x005B, 0x0061, 0x05D0, 0x0029, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 1, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  }
  
  TEST(bidi_character, bidi_character_125_058)
  {
  
      {
          // line 88091
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x005B, 0x0061, 0x05D0, 0x0029, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88092
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x005B, 0x0061, 0x05D0, 0x0029, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 1, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88093
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x005B, 0x0061, 0x05D0, 0x0029, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88094
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x005B, 0x0061, 0x0029, 0x05D0, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 1, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88095
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x005B, 0x0061, 0x0029, 0x05D0, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88096
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x005B, 0x0061, 0x0029, 0x05D0, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 1, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88097
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x005B, 0x0061, 0x0029, 0x05D0, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88098
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x005B, 0x0029, 0x0061, 0x05D0, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 1, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88099
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x005B, 0x0029, 0x0061, 0x05D0, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 1, 2, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88100
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x005B, 0x0029, 0x0061, 0x05D0, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 1, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  }
  
  TEST(bidi_character, bidi_character_125_059)
  {
  
      {
          // line 88101
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x005B, 0x0029, 0x0061, 0x05D0, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 1, 2, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88102
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x05D0, 0x2681, 0x0028, 0x005B, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 1, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88103
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x05D0, 0x2681, 0x0028, 0x005B, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 1, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88104
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x05D0, 0x0028, 0x2681, 0x005B, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 1, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88105
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x05D0, 0x0028, 0x2681, 0x005B, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 1, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88106
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x05D0, 0x0028, 0x005B, 0x2681, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 1, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88107
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x05D0, 0x0028, 0x005B, 0x2681, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 1, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88108
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x05D0, 0x0028, 0x005B, 0x0029, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 1, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88109
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x05D0, 0x0028, 0x005B, 0x0029, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 1, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88110
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x05D0, 0x0028, 0x005B, 0x0029, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 1, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  }
  
  TEST(bidi_character, bidi_character_125_060)
  {
  
      {
          // line 88111
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x05D0, 0x0028, 0x005B, 0x0029, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 1, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88112
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x05D0, 0x2681, 0x005B, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 1, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88113
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x05D0, 0x2681, 0x005B, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 1, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88114
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x05D0, 0x005B, 0x2681, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 1, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88115
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x05D0, 0x005B, 0x2681, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 1, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88116
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x05D0, 0x005B, 0x0029, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 1, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88117
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x05D0, 0x005B, 0x0029, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 1, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88118
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x05D0, 0x005B, 0x0029, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 1, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88119
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x05D0, 0x005B, 0x0029, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 1, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88120
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x005B, 0x05D0, 0x2681, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 1, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  }
  
  TEST(bidi_character, bidi_character_125_061)
  {
  
      {
          // line 88121
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x005B, 0x05D0, 0x2681, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 1, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88122
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x005B, 0x05D0, 0x0029, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 1, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88123
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x005B, 0x05D0, 0x0029, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 1, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88124
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x005B, 0x05D0, 0x0029, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 1, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88125
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x005B, 0x05D0, 0x0029, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 1, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88126
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x005B, 0x0029, 0x05D0, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 1, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88127
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x005B, 0x0029, 0x05D0, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 1, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88128
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x005B, 0x0029, 0x05D0, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 1, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88129
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x005B, 0x0029, 0x05D0, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 1, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88130
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x05D0, 0x2681, 0x005B, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 1, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  }
  
  TEST(bidi_character, bidi_character_125_062)
  {
  
      {
          // line 88131
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x05D0, 0x2681, 0x005B, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88132
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x05D0, 0x005B, 0x2681, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 1, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88133
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x05D0, 0x005B, 0x2681, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88134
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x05D0, 0x005B, 0x0029, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 1, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88135
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x05D0, 0x005B, 0x0029, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88136
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x05D0, 0x005B, 0x0029, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 1, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88137
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x05D0, 0x005B, 0x0029, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88138
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x005B, 0x05D0, 0x2681, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 1, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88139
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x005B, 0x05D0, 0x2681, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88140
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x005B, 0x05D0, 0x0029, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 1, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  }
  
  TEST(bidi_character, bidi_character_125_063)
  {
  
      {
          // line 88141
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x005B, 0x05D0, 0x0029, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88142
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x005B, 0x05D0, 0x0029, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 1, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88143
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x005B, 0x05D0, 0x0029, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88144
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x005B, 0x0029, 0x05D0, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 1, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88145
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x005B, 0x0029, 0x05D0, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88146
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x005B, 0x0029, 0x05D0, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 1, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88147
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x005B, 0x0029, 0x05D0, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88148
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x005B, 0x0061, 0x05D0, 0x2681, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 1, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88149
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x005B, 0x0061, 0x05D0, 0x2681, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88150
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x005B, 0x0061, 0x05D0, 0x0029, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 1, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  }
  
  TEST(bidi_character, bidi_character_125_064)
  {
  
      {
          // line 88151
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x005B, 0x0061, 0x05D0, 0x0029, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88152
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x005B, 0x0061, 0x05D0, 0x0029, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 1, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88153
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x005B, 0x0061, 0x05D0, 0x0029, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88154
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x005B, 0x0061, 0x0029, 0x05D0, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 1, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88155
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x005B, 0x0061, 0x0029, 0x05D0, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88156
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x005B, 0x0061, 0x0029, 0x05D0, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 1, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88157
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x005B, 0x0061, 0x0029, 0x05D0, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88158
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x005B, 0x0029, 0x0061, 0x05D0, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 1, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88159
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x005B, 0x0029, 0x0061, 0x05D0, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 1, 2, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88160
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x005B, 0x0029, 0x0061, 0x05D0, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 1, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  }
  
  TEST(bidi_character, bidi_character_125_065)
  {
  
      {
          // line 88161
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x005B, 0x0029, 0x0061, 0x05D0, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 1, 2, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88162
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x05D0, 0x2681, 0x005B, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 1, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88163
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x05D0, 0x2681, 0x005B, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88164
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x05D0, 0x005B, 0x2681, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 1, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88165
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x05D0, 0x005B, 0x2681, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88166
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x05D0, 0x005B, 0x0029, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 1, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88167
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x05D0, 0x005B, 0x0029, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88168
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x05D0, 0x005B, 0x0029, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 1, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88169
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x05D0, 0x005B, 0x0029, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88170
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x005B, 0x05D0, 0x2681, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 1, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  }
  
  TEST(bidi_character, bidi_character_125_066)
  {
  
      {
          // line 88171
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x005B, 0x05D0, 0x2681, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88172
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x005B, 0x05D0, 0x0029, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 1, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88173
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x005B, 0x05D0, 0x0029, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88174
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x005B, 0x05D0, 0x0029, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 1, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88175
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x005B, 0x05D0, 0x0029, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88176
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x005B, 0x0029, 0x05D0, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 1, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88177
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x005B, 0x0029, 0x05D0, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88178
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x005B, 0x0029, 0x05D0, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 1, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88179
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x005B, 0x0029, 0x05D0, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88180
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x005B, 0x0061, 0x05D0, 0x2681, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 1, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  }
  
  TEST(bidi_character, bidi_character_125_067)
  {
  
      {
          // line 88181
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x005B, 0x0061, 0x05D0, 0x2681, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88182
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x005B, 0x0061, 0x05D0, 0x0029, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 1, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88183
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x005B, 0x0061, 0x05D0, 0x0029, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88184
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x005B, 0x0061, 0x05D0, 0x0029, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 1, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88185
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x005B, 0x0061, 0x05D0, 0x0029, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88186
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x005B, 0x0061, 0x0029, 0x05D0, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 1, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88187
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x005B, 0x0061, 0x0029, 0x05D0, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88188
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x005B, 0x0061, 0x0029, 0x05D0, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 1, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88189
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x005B, 0x0061, 0x0029, 0x05D0, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88190
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x005B, 0x0029, 0x0061, 0x05D0, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 1, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  }
  
  TEST(bidi_character, bidi_character_125_068)
  {
  
      {
          // line 88191
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x005B, 0x0029, 0x0061, 0x05D0, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 1, 2, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88192
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x005B, 0x0029, 0x0061, 0x05D0, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 1, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88193
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x005B, 0x0029, 0x0061, 0x05D0, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 1, 2, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88194
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x005B, 0x2680, 0x0061, 0x05D0, 0x2681, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 1, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88195
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x005B, 0x2680, 0x0061, 0x05D0, 0x2681, 0x0029, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88196
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x005B, 0x2680, 0x0061, 0x05D0, 0x0029, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 1, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88197
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x005B, 0x2680, 0x0061, 0x05D0, 0x0029, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88198
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x005B, 0x2680, 0x0061, 0x05D0, 0x0029, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 1, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88199
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x005B, 0x2680, 0x0061, 0x05D0, 0x0029, 0x005D, 0x2681 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 2, 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 8, 7, 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 88200
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x005B, 0x2680, 0x0061, 0x0029, 0x05D0, 0x2681, 0x005D };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 0, 1, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
  }
  