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_013_000)
  {
  
      {
          // line 9101
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x2681, 0x0029, 0x0061, 0x05D0, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 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 =
              { 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 9102
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x2681, 0x0029, 0x0061, 0x0029, 0x05D0 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9103
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x2681, 0x0029, 0x0061, 0x0029, 0x05D0 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 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 =
              { 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 9104
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0029, 0x2681, 0x0061, 0x05D0, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9105
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0029, 0x2681, 0x0061, 0x05D0, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 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 =
              { 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 9106
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0029, 0x2681, 0x0061, 0x0029, 0x05D0 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9107
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0029, 0x2681, 0x0061, 0x0029, 0x05D0 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 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 =
              { 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 9108
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0029, 0x2681, 0x0061, 0x05D0, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9109
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0029, 0x2681, 0x0061, 0x05D0, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 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 =
              { 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 9110
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0029, 0x2681, 0x0061, 0x0029, 0x05D0 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_013_001)
  {
  
      {
          // line 9111
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0029, 0x2681, 0x0061, 0x0029, 0x05D0 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 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 =
              { 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 9114
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x2681, 0x05D0, 0x2682, 0x0028, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9115
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x2681, 0x05D0, 0x2682, 0x0028, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 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 9116
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x2681, 0x05D0, 0x0028, 0x2682, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9117
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x2681, 0x05D0, 0x0028, 0x2682, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 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 9118
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x2681, 0x05D0, 0x0028, 0x0029, 0x2682, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9119
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x2681, 0x05D0, 0x0028, 0x0029, 0x2682, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 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 9120
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x2681, 0x05D0, 0x0028, 0x0029, 0x0029, 0x2682 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9121
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x2681, 0x05D0, 0x0028, 0x0029, 0x0029, 0x2682 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 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 9122
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x2681, 0x0028, 0x05D0, 0x2682, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_013_002)
  {
  
      {
          // line 9123
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x2681, 0x0028, 0x05D0, 0x2682, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 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 9124
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x2681, 0x0028, 0x05D0, 0x0029, 0x2682, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9125
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x2681, 0x0028, 0x05D0, 0x0029, 0x2682, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 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 9126
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x2681, 0x0028, 0x05D0, 0x0029, 0x0029, 0x2682 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9127
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x2681, 0x0028, 0x05D0, 0x0029, 0x0029, 0x2682 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 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 9128
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x2681, 0x0028, 0x0029, 0x05D0, 0x2682, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9129
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x2681, 0x0028, 0x0029, 0x05D0, 0x2682, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 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 9130
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x2681, 0x0028, 0x0029, 0x05D0, 0x0029, 0x2682 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9131
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x2681, 0x0028, 0x0029, 0x05D0, 0x0029, 0x2682 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 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 9132
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x2681, 0x05D0, 0x2682, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_013_003)
  {
  
      {
          // line 9133
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x2681, 0x05D0, 0x2682, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 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 9134
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x2681, 0x05D0, 0x0029, 0x2682, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9135
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x2681, 0x05D0, 0x0029, 0x2682, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 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 9136
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x2681, 0x05D0, 0x0029, 0x0029, 0x2682 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9137
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x2681, 0x05D0, 0x0029, 0x0029, 0x2682 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 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 9138
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x2681, 0x0029, 0x05D0, 0x2682, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9139
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x2681, 0x0029, 0x05D0, 0x2682, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 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 9140
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x2681, 0x0029, 0x05D0, 0x0029, 0x2682 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9141
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x2681, 0x0029, 0x05D0, 0x0029, 0x2682 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 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 9142
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0029, 0x2681, 0x05D0, 0x2682, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_013_004)
  {
  
      {
          // line 9143
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0029, 0x2681, 0x05D0, 0x2682, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 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 9144
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0029, 0x2681, 0x05D0, 0x0029, 0x2682 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9145
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0029, 0x2681, 0x05D0, 0x0029, 0x2682 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 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 9146
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x2681, 0x05D0, 0x2682, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9147
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x2681, 0x05D0, 0x2682, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 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 9148
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x2681, 0x05D0, 0x0029, 0x2682, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9149
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x2681, 0x05D0, 0x0029, 0x2682, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 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 9150
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x2681, 0x05D0, 0x0029, 0x0029, 0x2682 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9151
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x2681, 0x05D0, 0x0029, 0x0029, 0x2682 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 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 9152
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x2681, 0x0029, 0x05D0, 0x2682, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_013_005)
  {
  
      {
          // line 9153
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x2681, 0x0029, 0x05D0, 0x2682, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 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 9154
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x2681, 0x0029, 0x05D0, 0x0029, 0x2682 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9155
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x2681, 0x0029, 0x05D0, 0x0029, 0x2682 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 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 9156
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0029, 0x2681, 0x05D0, 0x2682, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9157
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0029, 0x2681, 0x05D0, 0x2682, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 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 9158
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0029, 0x2681, 0x05D0, 0x0029, 0x2682 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9159
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0029, 0x2681, 0x05D0, 0x0029, 0x2682 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 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 9160
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0029, 0x2681, 0x05D0, 0x2682, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9161
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0029, 0x2681, 0x05D0, 0x2682, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 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 9162
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0029, 0x2681, 0x05D0, 0x0029, 0x2682 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_013_006)
  {
  
      {
          // line 9163
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0029, 0x2681, 0x05D0, 0x0029, 0x2682 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 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 9166
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x2681, 0x05D0, 0x0061, 0x0028, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9167
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x2681, 0x05D0, 0x0061, 0x0028, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9168
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x2681, 0x05D0, 0x0028, 0x0061, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9169
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x2681, 0x05D0, 0x0028, 0x0061, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 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 =
              { 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 9170
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x2681, 0x05D0, 0x0028, 0x0029, 0x0061, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9171
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x2681, 0x05D0, 0x0028, 0x0029, 0x0061, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 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 =
              { 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 9172
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x2681, 0x05D0, 0x0028, 0x0029, 0x0029, 0x0061 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9173
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x2681, 0x05D0, 0x0028, 0x0029, 0x0029, 0x0061 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 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 =
              { 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 9174
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x2681, 0x0028, 0x05D0, 0x0061, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_013_007)
  {
  
      {
          // line 9175
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x2681, 0x0028, 0x05D0, 0x0061, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 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 =
              { 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 9176
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x2681, 0x0028, 0x05D0, 0x0029, 0x0061, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9177
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x2681, 0x0028, 0x05D0, 0x0029, 0x0061, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 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 =
              { 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 9178
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x2681, 0x0028, 0x05D0, 0x0029, 0x0029, 0x0061 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9179
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x2681, 0x0028, 0x05D0, 0x0029, 0x0029, 0x0061 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 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 =
              { 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 9180
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x2681, 0x0028, 0x0029, 0x05D0, 0x0061, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9181
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x2681, 0x0028, 0x0029, 0x05D0, 0x0061, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 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 =
              { 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 9182
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x2681, 0x0028, 0x0029, 0x05D0, 0x0029, 0x0061 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9183
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x2681, 0x0028, 0x0029, 0x05D0, 0x0029, 0x0061 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 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 =
              { 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 9184
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x2681, 0x05D0, 0x0061, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_013_008)
  {
  
      {
          // line 9185
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x2681, 0x05D0, 0x0061, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 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 =
              { 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 9186
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x2681, 0x05D0, 0x0029, 0x0061, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9187
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x2681, 0x05D0, 0x0029, 0x0061, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 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 =
              { 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 9188
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x2681, 0x05D0, 0x0029, 0x0029, 0x0061 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9189
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x2681, 0x05D0, 0x0029, 0x0029, 0x0061 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 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 =
              { 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 9190
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x2681, 0x0029, 0x05D0, 0x0061, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9191
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x2681, 0x0029, 0x05D0, 0x0061, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 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 =
              { 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 9192
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x2681, 0x0029, 0x05D0, 0x0029, 0x0061 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9193
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x2681, 0x0029, 0x05D0, 0x0029, 0x0061 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 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 =
              { 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 9194
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0029, 0x2681, 0x05D0, 0x0061, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_013_009)
  {
  
      {
          // line 9195
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0029, 0x2681, 0x05D0, 0x0061, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 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 =
              { 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 9196
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0029, 0x2681, 0x05D0, 0x0029, 0x0061 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9197
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0029, 0x2681, 0x05D0, 0x0029, 0x0061 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 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 =
              { 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 9198
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x2681, 0x05D0, 0x0061, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9199
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x2681, 0x05D0, 0x0061, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 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 =
              { 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 9200
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x2681, 0x05D0, 0x0029, 0x0061, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9201
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x2681, 0x05D0, 0x0029, 0x0061, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 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 =
              { 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 9202
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x2681, 0x05D0, 0x0029, 0x0029, 0x0061 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9203
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x2681, 0x05D0, 0x0029, 0x0029, 0x0061 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 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 =
              { 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 9204
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x2681, 0x0029, 0x05D0, 0x0061, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_013_010)
  {
  
      {
          // line 9205
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x2681, 0x0029, 0x05D0, 0x0061, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 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 =
              { 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 9206
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x2681, 0x0029, 0x05D0, 0x0029, 0x0061 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9207
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x2681, 0x0029, 0x05D0, 0x0029, 0x0061 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 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 =
              { 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 9208
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0029, 0x2681, 0x05D0, 0x0061, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9209
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0029, 0x2681, 0x05D0, 0x0061, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 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 =
              { 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 9210
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0029, 0x2681, 0x05D0, 0x0029, 0x0061 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9211
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0029, 0x2681, 0x05D0, 0x0029, 0x0061 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 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 =
              { 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 9212
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0029, 0x2681, 0x05D0, 0x0061, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9213
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0029, 0x2681, 0x05D0, 0x0061, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 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 =
              { 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 9214
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0029, 0x2681, 0x05D0, 0x0029, 0x0061 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_013_011)
  {
  
      {
          // line 9215
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0029, 0x2681, 0x05D0, 0x0029, 0x0061 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 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 =
              { 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 9218
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x2681, 0x05D0, 0x0028, 0x05D1, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 1, 1, 1, 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, 6, 5, 4, 3, 7 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9219
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x2681, 0x05D0, 0x0028, 0x05D1, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 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 9220
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x2681, 0x05D0, 0x0028, 0x0029, 0x05D1, 0x0029 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 1, 1, 1, 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, 6, 5, 4, 3, 7 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9221
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x2681, 0x05D0, 0x0028, 0x0029, 0x05D1, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 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 9222
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x2681, 0x05D0, 0x0028, 0x0029, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9223
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x2681, 0x05D0, 0x0028, 0x0029, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 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 9224
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x2681, 0x0028, 0x05D0, 0x0029, 0x05D1, 0x0029 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9225
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x2681, 0x0028, 0x05D0, 0x0029, 0x05D1, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 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 9226
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x2681, 0x0028, 0x05D0, 0x0029, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_013_012)
  {
  
      {
          // line 9227
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x2681, 0x0028, 0x05D0, 0x0029, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 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 9228
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x2681, 0x0028, 0x0029, 0x05D0, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9229
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x2681, 0x0028, 0x0029, 0x05D0, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 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 9230
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x2681, 0x05D0, 0x0029, 0x05D1, 0x0029 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9231
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x2681, 0x05D0, 0x0029, 0x05D1, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 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 9232
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x2681, 0x05D0, 0x0029, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9233
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x2681, 0x05D0, 0x0029, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 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 9234
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x2681, 0x0029, 0x05D0, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9235
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x2681, 0x0029, 0x05D0, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 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 9236
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0029, 0x2681, 0x05D0, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_013_013)
  {
  
      {
          // line 9237
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0029, 0x2681, 0x05D0, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 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 9238
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x2681, 0x05D0, 0x0029, 0x05D1, 0x0029 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9239
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x2681, 0x05D0, 0x0029, 0x05D1, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 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 9240
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x2681, 0x05D0, 0x0029, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9241
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x2681, 0x05D0, 0x0029, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 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 9242
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x2681, 0x0029, 0x05D0, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9243
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x2681, 0x0029, 0x05D0, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 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 9244
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0029, 0x2681, 0x05D0, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9245
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0029, 0x2681, 0x05D0, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 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 9246
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0029, 0x2681, 0x05D0, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_013_014)
  {
  
      {
          // line 9247
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0029, 0x2681, 0x05D0, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 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 9250
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x2681, 0x0028, 0x2682, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9251
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x2681, 0x0028, 0x2682, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9252
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x2681, 0x0028, 0x0029, 0x2682, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9253
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x2681, 0x0028, 0x0029, 0x2682, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9254
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x2681, 0x0028, 0x0029, 0x0029, 0x2682 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9255
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x2681, 0x0028, 0x0029, 0x0029, 0x2682 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9256
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x2681, 0x0029, 0x2682, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9257
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x2681, 0x0029, 0x2682, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9258
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x2681, 0x0029, 0x0029, 0x2682 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_013_015)
  {
  
      {
          // line 9259
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x2681, 0x0029, 0x0029, 0x2682 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9260
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x0029, 0x2681, 0x0029, 0x2682 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9261
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x0029, 0x2681, 0x0029, 0x2682 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9262
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x2681, 0x0029, 0x2682, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9263
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x2681, 0x0029, 0x2682, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9264
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x2681, 0x0029, 0x0029, 0x2682 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9265
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x2681, 0x0029, 0x0029, 0x2682 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9266
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x0029, 0x2681, 0x0029, 0x2682 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9267
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x0029, 0x2681, 0x0029, 0x2682 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9268
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0029, 0x0061, 0x2681, 0x0029, 0x2682 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_013_016)
  {
  
      {
          // line 9269
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0029, 0x0061, 0x2681, 0x0029, 0x2682 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9270
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x2681, 0x0028, 0x2682, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9271
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x2681, 0x0028, 0x2682, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9272
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x2681, 0x0028, 0x0029, 0x2682, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9273
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x2681, 0x0028, 0x0029, 0x2682, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9274
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x2681, 0x0028, 0x0029, 0x0029, 0x2682 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9275
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x2681, 0x0028, 0x0029, 0x0029, 0x2682 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9276
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x2681, 0x0029, 0x2682, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9277
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x2681, 0x0029, 0x2682, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9278
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x2681, 0x0029, 0x0029, 0x2682 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_013_017)
  {
  
      {
          // line 9279
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x2681, 0x0029, 0x0029, 0x2682 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9280
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x0029, 0x2681, 0x0029, 0x2682 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9281
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x0029, 0x2681, 0x0029, 0x2682 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9282
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x2681, 0x0029, 0x2682, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9283
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x2681, 0x0029, 0x2682, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9284
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x2681, 0x0029, 0x0029, 0x2682 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9285
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x2681, 0x0029, 0x0029, 0x2682 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9286
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x0029, 0x2681, 0x0029, 0x2682 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9287
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x0029, 0x2681, 0x0029, 0x2682 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9288
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0029, 0x0061, 0x2681, 0x0029, 0x2682 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_013_018)
  {
  
      {
          // line 9289
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0029, 0x0061, 0x2681, 0x0029, 0x2682 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9290
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x2681, 0x0029, 0x2682, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9291
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x2681, 0x0029, 0x2682, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9292
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x2681, 0x0029, 0x0029, 0x2682 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9293
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x2681, 0x0029, 0x0029, 0x2682 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9294
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x0029, 0x2681, 0x0029, 0x2682 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9295
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x0029, 0x2681, 0x0029, 0x2682 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9296
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0029, 0x0061, 0x2681, 0x0029, 0x2682 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9297
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0029, 0x0061, 0x2681, 0x0029, 0x2682 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9298
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x0029, 0x2680, 0x0061, 0x2681, 0x0029, 0x2682 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_013_019)
  {
  
      {
          // line 9299
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x0029, 0x2680, 0x0061, 0x2681, 0x0029, 0x2682 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9302
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x2681, 0x0062, 0x0028, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9303
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x2681, 0x0062, 0x0028, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 7, 6, 5, 2, 3, 4, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9304
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x2681, 0x0028, 0x0062, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9305
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x2681, 0x0028, 0x0062, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 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 9306
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x2681, 0x0028, 0x0029, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9307
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x2681, 0x0028, 0x0029, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 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 9308
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x2681, 0x0028, 0x0029, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9309
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x2681, 0x0028, 0x0029, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9310
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x2681, 0x0062, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_013_020)
  {
  
      {
          // line 9311
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x2681, 0x0062, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 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 9312
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x2681, 0x0029, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9313
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x2681, 0x0029, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 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 9314
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x2681, 0x0029, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9315
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x2681, 0x0029, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9316
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x0029, 0x2681, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9317
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x0029, 0x2681, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 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 9318
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x0029, 0x2681, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9319
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x0029, 0x2681, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9320
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x0029, 0x0029, 0x2681, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_013_021)
  {
  
      {
          // line 9321
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x0029, 0x0029, 0x2681, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9322
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x2681, 0x0062, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9323
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x2681, 0x0062, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9324
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x2681, 0x0029, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9325
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x2681, 0x0029, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9326
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x2681, 0x0029, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9327
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x2681, 0x0029, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9328
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x0029, 0x2681, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9329
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x0029, 0x2681, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9330
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x0029, 0x2681, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_013_022)
  {
  
      {
          // line 9331
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x0029, 0x2681, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9332
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x0029, 0x0029, 0x2681, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9333
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x0029, 0x0029, 0x2681, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9334
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0029, 0x0061, 0x2681, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9335
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0029, 0x0061, 0x2681, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9336
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0029, 0x0061, 0x2681, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9337
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0029, 0x0061, 0x2681, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 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 =
              { 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 9338
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0029, 0x0061, 0x0029, 0x2681, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9339
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0029, 0x0061, 0x0029, 0x2681, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 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 =
              { 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 9340
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x2681, 0x0062, 0x0028, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_013_023)
  {
  
      {
          // line 9341
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x2681, 0x0062, 0x0028, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 7, 6, 5, 2, 3, 4, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9342
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x2681, 0x0028, 0x0062, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9343
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x2681, 0x0028, 0x0062, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 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 9344
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x2681, 0x0028, 0x0029, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9345
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x2681, 0x0028, 0x0029, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 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 9346
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x2681, 0x0028, 0x0029, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9347
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x2681, 0x0028, 0x0029, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9348
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x2681, 0x0062, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9349
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x2681, 0x0062, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 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 9350
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x2681, 0x0029, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_013_024)
  {
  
      {
          // line 9351
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x2681, 0x0029, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 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 9352
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x2681, 0x0029, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9353
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x2681, 0x0029, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9354
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x0029, 0x2681, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9355
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x0029, 0x2681, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 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 9356
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x0029, 0x2681, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9357
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x0029, 0x2681, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9358
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x0029, 0x0029, 0x2681, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9359
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x0029, 0x0029, 0x2681, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9360
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x2681, 0x0062, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_013_025)
  {
  
      {
          // line 9361
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x2681, 0x0062, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9362
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x2681, 0x0029, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9363
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x2681, 0x0029, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9364
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x2681, 0x0029, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9365
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x2681, 0x0029, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9366
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x0029, 0x2681, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9367
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x0029, 0x2681, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9368
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x0029, 0x2681, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9369
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x0029, 0x2681, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9370
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x0029, 0x0029, 0x2681, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_013_026)
  {
  
      {
          // line 9371
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x0029, 0x0029, 0x2681, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9372
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0029, 0x0061, 0x2681, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9373
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0029, 0x0061, 0x2681, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9374
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0029, 0x0061, 0x2681, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9375
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0029, 0x0061, 0x2681, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 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 =
              { 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 9376
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0029, 0x0061, 0x0029, 0x2681, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9377
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0029, 0x0061, 0x0029, 0x2681, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 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 =
              { 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 9378
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x2681, 0x0062, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9379
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x2681, 0x0062, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9380
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x2681, 0x0029, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_013_027)
  {
  
      {
          // line 9381
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x2681, 0x0029, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9382
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x2681, 0x0029, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9383
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x2681, 0x0029, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9384
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x0029, 0x2681, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9385
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x0029, 0x2681, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9386
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x0029, 0x2681, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9387
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x0029, 0x2681, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9388
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x0029, 0x0029, 0x2681, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9389
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x0029, 0x0029, 0x2681, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9390
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0029, 0x0061, 0x2681, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_013_028)
  {
  
      {
          // line 9391
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0029, 0x0061, 0x2681, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9392
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0029, 0x0061, 0x2681, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9393
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0029, 0x0061, 0x2681, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 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 =
              { 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 9394
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0029, 0x0061, 0x0029, 0x2681, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9395
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0029, 0x0061, 0x0029, 0x2681, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 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 =
              { 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 9396
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x0029, 0x2680, 0x0061, 0x2681, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9397
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x0029, 0x2680, 0x0061, 0x2681, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9398
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x0029, 0x2680, 0x0061, 0x2681, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9399
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x0029, 0x2680, 0x0061, 0x2681, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 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 =
              { 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 9400
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x0029, 0x2680, 0x0061, 0x0029, 0x2681, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_013_029)
  {
  
      {
          // line 9401
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x0029, 0x2680, 0x0061, 0x0029, 0x2681, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 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 =
              { 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 9404
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x2681, 0x05D0, 0x0028, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9405
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x2681, 0x05D0, 0x0028, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9406
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x2681, 0x0028, 0x05D0, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9407
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x2681, 0x0028, 0x05D0, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9408
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x2681, 0x0028, 0x0029, 0x05D0, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9409
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x2681, 0x0028, 0x0029, 0x05D0, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9410
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x2681, 0x0028, 0x0029, 0x0029, 0x05D0 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9411
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x2681, 0x0028, 0x0029, 0x0029, 0x05D0 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9412
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x2681, 0x05D0, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_013_030)
  {
  
      {
          // line 9413
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x2681, 0x05D0, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9414
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x2681, 0x0029, 0x05D0, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9415
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x2681, 0x0029, 0x05D0, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9416
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x2681, 0x0029, 0x0029, 0x05D0 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9417
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x2681, 0x0029, 0x0029, 0x05D0 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9418
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x0029, 0x2681, 0x05D0, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9419
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x0029, 0x2681, 0x05D0, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9420
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x0029, 0x2681, 0x0029, 0x05D0 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9421
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x0029, 0x2681, 0x0029, 0x05D0 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9422
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x0029, 0x0029, 0x2681, 0x05D0 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_013_031)
  {
  
      {
          // line 9423
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x0029, 0x0029, 0x2681, 0x05D0 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9424
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x2681, 0x05D0, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9425
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x2681, 0x05D0, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9426
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x2681, 0x0029, 0x05D0, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9427
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x2681, 0x0029, 0x05D0, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9428
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x2681, 0x0029, 0x0029, 0x05D0 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9429
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x2681, 0x0029, 0x0029, 0x05D0 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9430
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x0029, 0x2681, 0x05D0, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9431
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x0029, 0x2681, 0x05D0, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9432
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x0029, 0x2681, 0x0029, 0x05D0 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_013_032)
  {
  
      {
          // line 9433
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x0029, 0x2681, 0x0029, 0x05D0 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9434
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x0029, 0x0029, 0x2681, 0x05D0 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9435
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x0029, 0x0029, 0x2681, 0x05D0 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9436
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0029, 0x0061, 0x2681, 0x05D0, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9437
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0029, 0x0061, 0x2681, 0x05D0, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9438
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0029, 0x0061, 0x2681, 0x0029, 0x05D0 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9439
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0029, 0x0061, 0x2681, 0x0029, 0x05D0 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9440
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0029, 0x0061, 0x0029, 0x2681, 0x05D0 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9441
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0029, 0x0061, 0x0029, 0x2681, 0x05D0 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9442
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x2681, 0x05D0, 0x0028, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_013_033)
  {
  
      {
          // line 9443
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x2681, 0x05D0, 0x0028, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9444
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x2681, 0x0028, 0x05D0, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9445
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x2681, 0x0028, 0x05D0, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9446
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x2681, 0x0028, 0x0029, 0x05D0, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9447
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x2681, 0x0028, 0x0029, 0x05D0, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9448
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x2681, 0x0028, 0x0029, 0x0029, 0x05D0 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9449
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x2681, 0x0028, 0x0029, 0x0029, 0x05D0 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9450
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x2681, 0x05D0, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9451
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x2681, 0x05D0, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9452
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x2681, 0x0029, 0x05D0, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_013_034)
  {
  
      {
          // line 9453
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x2681, 0x0029, 0x05D0, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9454
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x2681, 0x0029, 0x0029, 0x05D0 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9455
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x2681, 0x0029, 0x0029, 0x05D0 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9456
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x0029, 0x2681, 0x05D0, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9457
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x0029, 0x2681, 0x05D0, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9458
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x0029, 0x2681, 0x0029, 0x05D0 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9459
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x0029, 0x2681, 0x0029, 0x05D0 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9460
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x0029, 0x0029, 0x2681, 0x05D0 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9461
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x0029, 0x0029, 0x2681, 0x05D0 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9462
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x2681, 0x05D0, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_013_035)
  {
  
      {
          // line 9463
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x2681, 0x05D0, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9464
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x2681, 0x0029, 0x05D0, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9465
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x2681, 0x0029, 0x05D0, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9466
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x2681, 0x0029, 0x0029, 0x05D0 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9467
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x2681, 0x0029, 0x0029, 0x05D0 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9468
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x0029, 0x2681, 0x05D0, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9469
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x0029, 0x2681, 0x05D0, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9470
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x0029, 0x2681, 0x0029, 0x05D0 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9471
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x0029, 0x2681, 0x0029, 0x05D0 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9472
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x0029, 0x0029, 0x2681, 0x05D0 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_013_036)
  {
  
      {
          // line 9473
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x0029, 0x0029, 0x2681, 0x05D0 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9474
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0029, 0x0061, 0x2681, 0x05D0, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9475
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0029, 0x0061, 0x2681, 0x05D0, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9476
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0029, 0x0061, 0x2681, 0x0029, 0x05D0 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9477
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0029, 0x0061, 0x2681, 0x0029, 0x05D0 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9478
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0029, 0x0061, 0x0029, 0x2681, 0x05D0 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9479
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0029, 0x0061, 0x0029, 0x2681, 0x05D0 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9480
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x2681, 0x05D0, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9481
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x2681, 0x05D0, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9482
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x2681, 0x0029, 0x05D0, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_013_037)
  {
  
      {
          // line 9483
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x2681, 0x0029, 0x05D0, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9484
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x2681, 0x0029, 0x0029, 0x05D0 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9485
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x2681, 0x0029, 0x0029, 0x05D0 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9486
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x0029, 0x2681, 0x05D0, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9487
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x0029, 0x2681, 0x05D0, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9488
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x0029, 0x2681, 0x0029, 0x05D0 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9489
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x0029, 0x2681, 0x0029, 0x05D0 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9490
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x0029, 0x0029, 0x2681, 0x05D0 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9491
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x0029, 0x0029, 0x2681, 0x05D0 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9492
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0029, 0x0061, 0x2681, 0x05D0, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_013_038)
  {
  
      {
          // line 9493
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0029, 0x0061, 0x2681, 0x05D0, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9494
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0029, 0x0061, 0x2681, 0x0029, 0x05D0 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9495
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0029, 0x0061, 0x2681, 0x0029, 0x05D0 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9496
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0029, 0x0061, 0x0029, 0x2681, 0x05D0 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9497
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0029, 0x0061, 0x0029, 0x2681, 0x05D0 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9498
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x0029, 0x2680, 0x0061, 0x2681, 0x05D0, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9499
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x0029, 0x2680, 0x0061, 0x2681, 0x05D0, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9500
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x0029, 0x2680, 0x0061, 0x2681, 0x0029, 0x05D0 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9501
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x0029, 0x2680, 0x0061, 0x2681, 0x0029, 0x05D0 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9502
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x0029, 0x2680, 0x0061, 0x0029, 0x2681, 0x05D0 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_013_039)
  {
  
      {
          // line 9503
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x0029, 0x2680, 0x0061, 0x0029, 0x2681, 0x05D0 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9506
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x0062, 0x2681, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9507
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x0062, 0x2681, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 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 9508
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x0062, 0x0029, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9509
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x0062, 0x0029, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 7, 6, 2, 3, 4, 5, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9510
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x0062, 0x0029, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9511
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x0062, 0x0029, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 =
              { 7, 6, 2, 3, 4, 5, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9512
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x0029, 0x0062, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9513
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x0029, 0x0062, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 7, 6, 2, 3, 4, 5, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9514
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x0029, 0x0062, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_013_040)
  {
  
      {
          // line 9515
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x0029, 0x0062, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 =
              { 7, 6, 2, 3, 4, 5, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9516
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x0029, 0x0062, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9517
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x0029, 0x0062, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9518
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x0029, 0x0062, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9519
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x0029, 0x0062, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9520
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x0062, 0x2681, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9521
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x0062, 0x2681, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 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 9522
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x0062, 0x0029, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9523
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x0062, 0x0029, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 7, 6, 2, 3, 4, 5, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9524
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x0062, 0x0029, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_013_041)
  {
  
      {
          // line 9525
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x0062, 0x0029, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 =
              { 7, 6, 2, 3, 4, 5, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9526
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x0029, 0x0062, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9527
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x0029, 0x0062, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 7, 6, 2, 3, 4, 5, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9528
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x0029, 0x0062, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9529
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x0029, 0x0062, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 =
              { 7, 6, 2, 3, 4, 5, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9530
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x0029, 0x0062, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9531
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x0029, 0x0062, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9532
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x0029, 0x0062, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9533
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x0029, 0x0062, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9534
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x0029, 0x0062, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_013_042)
  {
  
      {
          // line 9535
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x0029, 0x0062, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9536
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x0029, 0x0062, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9537
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x0029, 0x0062, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9540
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x0062, 0x0029, 0x0063, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9541
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x0062, 0x0029, 0x0063, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 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 9542
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x0062, 0x0029, 0x0029, 0x0063 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9543
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x0062, 0x0029, 0x0029, 0x0063 };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 2, 2, 2, 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 =
              { 7, 6, 2, 3, 4, 5, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9544
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x0029, 0x0062, 0x0029, 0x0063 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9545
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x0029, 0x0062, 0x0029, 0x0063 };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 2, 2, 2, 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 =
              { 7, 6, 2, 3, 4, 5, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9546
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x0029, 0x0062, 0x0029, 0x0063 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_013_043)
  {
  
      {
          // line 9547
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x0029, 0x0062, 0x0029, 0x0063 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 2, 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 =
              { 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 9548
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x0062, 0x0029, 0x0063, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9549
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x0062, 0x0029, 0x0063, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 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 9550
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x0062, 0x0029, 0x0029, 0x0063 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9551
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x0062, 0x0029, 0x0029, 0x0063 };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 2, 2, 2, 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 =
              { 7, 6, 2, 3, 4, 5, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9552
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x0029, 0x0062, 0x0029, 0x0063 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9553
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x0029, 0x0062, 0x0029, 0x0063 };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 2, 2, 2, 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 =
              { 7, 6, 2, 3, 4, 5, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9554
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x0029, 0x0062, 0x0029, 0x0063 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9555
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x0029, 0x0062, 0x0029, 0x0063 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 2, 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 =
              { 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 9556
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x0029, 0x0062, 0x0029, 0x0063 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_013_044)
  {
  
      {
          // line 9557
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x0029, 0x0062, 0x0029, 0x0063 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 1, 2, 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 =
              { 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 9560
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x0062, 0x05D0, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9561
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x0062, 0x05D0, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 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 =
              { 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 9562
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x0062, 0x0029, 0x05D0, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9563
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x0062, 0x0029, 0x05D0, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 7, 6, 2, 3, 4, 5, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9564
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x0062, 0x0029, 0x0029, 0x05D0 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9565
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x0062, 0x0029, 0x0029, 0x05D0 };
          std::vector<int> const expected_levels =
              { 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 =
              { 7, 6, 2, 3, 4, 5, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9566
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x0029, 0x0062, 0x05D0, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9567
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x0029, 0x0062, 0x05D0, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 7, 6, 2, 3, 4, 5, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9568
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x0029, 0x0062, 0x0029, 0x05D0 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_013_045)
  {
  
      {
          // line 9569
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x0029, 0x0062, 0x0029, 0x05D0 };
          std::vector<int> const expected_levels =
              { 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 =
              { 7, 6, 2, 3, 4, 5, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9570
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x0029, 0x0062, 0x05D0, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9571
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x0029, 0x0062, 0x05D0, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9572
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x0029, 0x0062, 0x0029, 0x05D0 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9573
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x0029, 0x0062, 0x0029, 0x05D0 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9574
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x0062, 0x05D0, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9575
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x0062, 0x05D0, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 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 =
              { 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 9576
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x0062, 0x0029, 0x05D0, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9577
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x0062, 0x0029, 0x05D0, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 7, 6, 2, 3, 4, 5, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9578
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x0062, 0x0029, 0x0029, 0x05D0 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_013_046)
  {
  
      {
          // line 9579
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x0062, 0x0029, 0x0029, 0x05D0 };
          std::vector<int> const expected_levels =
              { 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 =
              { 7, 6, 2, 3, 4, 5, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9580
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x0029, 0x0062, 0x05D0, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9581
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x0029, 0x0062, 0x05D0, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 7, 6, 2, 3, 4, 5, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9582
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x0029, 0x0062, 0x0029, 0x05D0 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9583
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x0029, 0x0062, 0x0029, 0x05D0 };
          std::vector<int> const expected_levels =
              { 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 =
              { 7, 6, 2, 3, 4, 5, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9584
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x0029, 0x0062, 0x05D0, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9585
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x0029, 0x0062, 0x05D0, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9586
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x0029, 0x0062, 0x0029, 0x05D0 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9587
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x0029, 0x0062, 0x0029, 0x05D0 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9588
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x0029, 0x0062, 0x05D0, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_013_047)
  {
  
      {
          // line 9589
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x0029, 0x0062, 0x05D0, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9590
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x0029, 0x0062, 0x0029, 0x05D0 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9591
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x0029, 0x0062, 0x0029, 0x05D0 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9594
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x05D0, 0x2681, 0x0028, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9595
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x05D0, 0x2681, 0x0028, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9596
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x05D0, 0x0028, 0x2681, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9597
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x05D0, 0x0028, 0x2681, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9598
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x05D0, 0x0028, 0x0029, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9599
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x05D0, 0x0028, 0x0029, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9600
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x05D0, 0x0028, 0x0029, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_013_048)
  {
  
      {
          // line 9601
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x05D0, 0x0028, 0x0029, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9602
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x05D0, 0x2681, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9603
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x05D0, 0x2681, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9604
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x05D0, 0x0029, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9605
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x05D0, 0x0029, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9606
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x05D0, 0x0029, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9607
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x05D0, 0x0029, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9608
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x0029, 0x05D0, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9609
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x0029, 0x05D0, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9610
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x0029, 0x05D0, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_013_049)
  {
  
      {
          // line 9611
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x0029, 0x05D0, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9612
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x05D0, 0x2681, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9613
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x05D0, 0x2681, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9614
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x05D0, 0x0029, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9615
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x05D0, 0x0029, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9616
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x05D0, 0x0029, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9617
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x05D0, 0x0029, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9618
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x0029, 0x05D0, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9619
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x0029, 0x05D0, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9620
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x0029, 0x05D0, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_013_050)
  {
  
      {
          // line 9621
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x0029, 0x05D0, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9622
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0029, 0x0061, 0x05D0, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9623
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0029, 0x0061, 0x05D0, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9624
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0029, 0x0061, 0x05D0, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9625
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0029, 0x0061, 0x05D0, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9626
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x05D0, 0x2681, 0x0028, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9627
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x05D0, 0x2681, 0x0028, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9628
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x05D0, 0x0028, 0x2681, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9629
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x05D0, 0x0028, 0x2681, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9630
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x05D0, 0x0028, 0x0029, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_013_051)
  {
  
      {
          // line 9631
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x05D0, 0x0028, 0x0029, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9632
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x05D0, 0x0028, 0x0029, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9633
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x05D0, 0x0028, 0x0029, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9634
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x05D0, 0x2681, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9635
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x05D0, 0x2681, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9636
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x05D0, 0x0029, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9637
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x05D0, 0x0029, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9638
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x05D0, 0x0029, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9639
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x05D0, 0x0029, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9640
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x0029, 0x05D0, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_013_052)
  {
  
      {
          // line 9641
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x0029, 0x05D0, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9642
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x0029, 0x05D0, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9643
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x0029, 0x05D0, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9644
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x05D0, 0x2681, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9645
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x05D0, 0x2681, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9646
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x05D0, 0x0029, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9647
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x05D0, 0x0029, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9648
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x05D0, 0x0029, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9649
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x05D0, 0x0029, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9650
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x0029, 0x05D0, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_013_053)
  {
  
      {
          // line 9651
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x0029, 0x05D0, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9652
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x0029, 0x05D0, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9653
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x0029, 0x05D0, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9654
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0029, 0x0061, 0x05D0, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9655
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0029, 0x0061, 0x05D0, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9656
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0029, 0x0061, 0x05D0, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9657
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0029, 0x0061, 0x05D0, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9658
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x05D0, 0x2681, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9659
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x05D0, 0x2681, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9660
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x05D0, 0x0029, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_013_054)
  {
  
      {
          // line 9661
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x05D0, 0x0029, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9662
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x05D0, 0x0029, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9663
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x05D0, 0x0029, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9664
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x0029, 0x05D0, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9665
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x0029, 0x05D0, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9666
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x0029, 0x05D0, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9667
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x0029, 0x05D0, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9668
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0029, 0x0061, 0x05D0, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9669
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0029, 0x0061, 0x05D0, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9670
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0029, 0x0061, 0x05D0, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_013_055)
  {
  
      {
          // line 9671
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0029, 0x0061, 0x05D0, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9672
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x0029, 0x2680, 0x0061, 0x05D0, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9673
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x0029, 0x2680, 0x0061, 0x05D0, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9674
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x0029, 0x2680, 0x0061, 0x05D0, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9675
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x0029, 0x2680, 0x0061, 0x05D0, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9678
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x05D0, 0x0062, 0x0028, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9679
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x05D0, 0x0062, 0x0028, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 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 =
              { 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 9680
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x05D0, 0x0028, 0x0062, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9681
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x05D0, 0x0028, 0x0062, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9682
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x05D0, 0x0028, 0x0029, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_013_056)
  {
  
      {
          // line 9683
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x05D0, 0x0028, 0x0029, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9684
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x05D0, 0x0028, 0x0029, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9685
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x05D0, 0x0028, 0x0029, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9686
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x05D0, 0x0062, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9687
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x05D0, 0x0062, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9688
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x05D0, 0x0029, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9689
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x05D0, 0x0029, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9690
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x05D0, 0x0029, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9691
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x05D0, 0x0029, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9692
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x0029, 0x05D0, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_013_057)
  {
  
      {
          // line 9693
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x0029, 0x05D0, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9694
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x0029, 0x05D0, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9695
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x0029, 0x05D0, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9696
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x05D0, 0x0062, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9697
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x05D0, 0x0062, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9698
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x05D0, 0x0029, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9699
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x05D0, 0x0029, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9700
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x05D0, 0x0029, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9701
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x05D0, 0x0029, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9702
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x0029, 0x05D0, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_013_058)
  {
  
      {
          // line 9703
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x0029, 0x05D0, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9704
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x0029, 0x05D0, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9705
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x0029, 0x05D0, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9706
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0029, 0x0061, 0x05D0, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9707
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0029, 0x0061, 0x05D0, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 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 =
              { 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 9708
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0029, 0x0061, 0x05D0, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9709
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0029, 0x0061, 0x05D0, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 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 =
              { 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 9710
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x05D0, 0x0062, 0x0028, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9711
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x05D0, 0x0062, 0x0028, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 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 =
              { 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 9712
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x05D0, 0x0028, 0x0062, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_013_059)
  {
  
      {
          // line 9713
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x05D0, 0x0028, 0x0062, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9714
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x05D0, 0x0028, 0x0029, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9715
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x05D0, 0x0028, 0x0029, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9716
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x05D0, 0x0028, 0x0029, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9717
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x05D0, 0x0028, 0x0029, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9718
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x05D0, 0x0062, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9719
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x05D0, 0x0062, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9720
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x05D0, 0x0029, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9721
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x05D0, 0x0029, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9722
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x05D0, 0x0029, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_013_060)
  {
  
      {
          // line 9723
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x05D0, 0x0029, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9724
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x0029, 0x05D0, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9725
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x0029, 0x05D0, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9726
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x0029, 0x05D0, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9727
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x0029, 0x05D0, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9728
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x05D0, 0x0062, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9729
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x05D0, 0x0062, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9730
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x05D0, 0x0029, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9731
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x05D0, 0x0029, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9732
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x05D0, 0x0029, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_013_061)
  {
  
      {
          // line 9733
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x05D0, 0x0029, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9734
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x0029, 0x05D0, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9735
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x0029, 0x05D0, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9736
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x0029, 0x05D0, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9737
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x0029, 0x05D0, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9738
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0029, 0x0061, 0x05D0, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9739
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0029, 0x0061, 0x05D0, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 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 =
              { 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 9740
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0029, 0x0061, 0x05D0, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9741
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0029, 0x0061, 0x05D0, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 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 =
              { 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 9742
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x05D0, 0x0062, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_013_062)
  {
  
      {
          // line 9743
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x05D0, 0x0062, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9744
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x05D0, 0x0029, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9745
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x05D0, 0x0029, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9746
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x05D0, 0x0029, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9747
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x05D0, 0x0029, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9748
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x0029, 0x05D0, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9749
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x0029, 0x05D0, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9750
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x0029, 0x05D0, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9751
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0061, 0x0029, 0x05D0, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9752
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0029, 0x0061, 0x05D0, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_013_063)
  {
  
      {
          // line 9753
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0029, 0x0061, 0x05D0, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 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 =
              { 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 9754
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0029, 0x0061, 0x05D0, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9755
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x2680, 0x0029, 0x0061, 0x05D0, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 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 =
              { 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 9756
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x0029, 0x2680, 0x0061, 0x05D0, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9757
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x0029, 0x2680, 0x0061, 0x05D0, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 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 =
              { 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 9758
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x0029, 0x2680, 0x0061, 0x05D0, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9759
          std::vector<uint32_t> const cps = { 0x0028, 0x0028, 0x0029, 0x2680, 0x0061, 0x05D0, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 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 =
              { 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 9762
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x05D0, 0x0028, 0x05D1, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 1, 1, 1, 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, 6, 5, 4, 3, 7 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9763
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x05D0, 0x0028, 0x05D1, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9764
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x05D0, 0x0028, 0x0029, 0x05D1, 0x0029 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 1, 1, 1, 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, 6, 5, 4, 3, 7 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_013_064)
  {
  
      {
          // line 9765
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x05D0, 0x0028, 0x0029, 0x05D1, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9766
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x05D0, 0x0028, 0x0029, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9767
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x05D0, 0x0028, 0x0029, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9768
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x05D0, 0x0029, 0x05D1, 0x0029 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9769
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x05D0, 0x0029, 0x05D1, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9770
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x05D0, 0x0029, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9771
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x05D0, 0x0029, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9772
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x0029, 0x05D0, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9773
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x0028, 0x0029, 0x05D0, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9774
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x05D0, 0x0029, 0x05D1, 0x0029 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_013_065)
  {
  
      {
          // line 9775
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x05D0, 0x0029, 0x05D1, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9776
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x05D0, 0x0029, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9777
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x05D0, 0x0029, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9778
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x0029, 0x05D0, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9779
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0061, 0x0029, 0x05D0, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9780
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0029, 0x0061, 0x05D0, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9781
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0028, 0x0029, 0x0061, 0x05D0, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9782
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x05D0, 0x0028, 0x05D1, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 1, 1, 1, 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, 6, 5, 4, 3, 7 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9783
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x05D0, 0x0028, 0x05D1, 0x0029, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9784
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x05D0, 0x0028, 0x0029, 0x05D1, 0x0029 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 1, 1, 1, 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, 6, 5, 4, 3, 7 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_013_066)
  {
  
      {
          // line 9785
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x05D0, 0x0028, 0x0029, 0x05D1, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9786
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x05D0, 0x0028, 0x0029, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9787
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x05D0, 0x0028, 0x0029, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9788
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x05D0, 0x0029, 0x05D1, 0x0029 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9789
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x05D0, 0x0029, 0x05D1, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9790
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x05D0, 0x0029, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9791
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x05D0, 0x0029, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9792
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x0029, 0x05D0, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9793
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x0028, 0x0029, 0x05D0, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9794
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x05D0, 0x0029, 0x05D1, 0x0029 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_013_067)
  {
  
      {
          // line 9795
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x05D0, 0x0029, 0x05D1, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9796
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x05D0, 0x0029, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9797
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x05D0, 0x0029, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9798
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x0029, 0x05D0, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 9799
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0061, 0x0029, 0x05D0, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 9800
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0028, 0x0029, 0x0061, 0x05D0, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0, 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
  }
  