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_057_000)
  {
  
      {
          // line 39901
          std::vector<uint32_t> const cps = { 0x05D0, 0x2680, 0x005B, 0x0028, 0x2681, 0x0061, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39902
          std::vector<uint32_t> const cps = { 0x05D0, 0x2680, 0x005B, 0x0028, 0x2681, 0x0029, 0x0061 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39903
          std::vector<uint32_t> const cps = { 0x05D0, 0x2680, 0x005B, 0x0028, 0x2681, 0x0029, 0x0061 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39904
          std::vector<uint32_t> const cps = { 0x05D0, 0x2680, 0x005B, 0x0028, 0x0029, 0x2681, 0x0061 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39905
          std::vector<uint32_t> const cps = { 0x05D0, 0x2680, 0x005B, 0x0028, 0x0029, 0x2681, 0x0061 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39906
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x2680, 0x0028, 0x2681, 0x0061, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39907
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x2680, 0x0028, 0x2681, 0x0061, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39908
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x2680, 0x0028, 0x2681, 0x0029, 0x0061 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39909
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x2680, 0x0028, 0x2681, 0x0029, 0x0061 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39910
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x2680, 0x0028, 0x0029, 0x2681, 0x0061 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_057_001)
  {
  
      {
          // line 39911
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x2680, 0x0028, 0x0029, 0x2681, 0x0061 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39912
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0028, 0x2680, 0x0029, 0x2681, 0x0061 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39913
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0028, 0x2680, 0x0029, 0x2681, 0x0061 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39914
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x2680, 0x0028, 0x2681, 0x0061, 0x0029 };
          std::vector<int> const expected_levels =
              { 0, 1, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39915
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x2680, 0x0028, 0x2681, 0x0061, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39916
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x2680, 0x0028, 0x2681, 0x0029, 0x0061 };
          std::vector<int> const expected_levels =
              { 0, 1, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39917
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x2680, 0x0028, 0x2681, 0x0029, 0x0061 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39918
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x2680, 0x0028, 0x0029, 0x2681, 0x0061 };
          std::vector<int> const expected_levels =
              { 0, 1, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39919
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x2680, 0x0028, 0x0029, 0x2681, 0x0061 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39920
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0028, 0x2680, 0x0029, 0x2681, 0x0061 };
          std::vector<int> const expected_levels =
              { 0, 1, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_057_002)
  {
  
      {
          // line 39921
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0028, 0x2680, 0x0029, 0x2681, 0x0061 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39922
          std::vector<uint32_t> const cps = { 0x005B, 0x0028, 0x05D0, 0x2680, 0x0029, 0x2681, 0x0061 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39923
          std::vector<uint32_t> const cps = { 0x005B, 0x0028, 0x05D0, 0x2680, 0x0029, 0x2681, 0x0061 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39926
          std::vector<uint32_t> const cps = { 0x05D0, 0x2680, 0x005B, 0x2681, 0x05D1, 0x0028, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 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 =
              { 4, 3, 2, 1, 0, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39927
          std::vector<uint32_t> const cps = { 0x05D0, 0x2680, 0x005B, 0x2681, 0x05D1, 0x0028, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39928
          std::vector<uint32_t> const cps = { 0x05D0, 0x2680, 0x005B, 0x2681, 0x0028, 0x05D1, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 1, 1, 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39929
          std::vector<uint32_t> const cps = { 0x05D0, 0x2680, 0x005B, 0x2681, 0x0028, 0x05D1, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39930
          std::vector<uint32_t> const cps = { 0x05D0, 0x2680, 0x005B, 0x2681, 0x0028, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 1, 1, 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39931
          std::vector<uint32_t> const cps = { 0x05D0, 0x2680, 0x005B, 0x2681, 0x0028, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39932
          std::vector<uint32_t> const cps = { 0x05D0, 0x2680, 0x005B, 0x0028, 0x2681, 0x05D1, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 1, 1, 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_057_003)
  {
  
      {
          // line 39933
          std::vector<uint32_t> const cps = { 0x05D0, 0x2680, 0x005B, 0x0028, 0x2681, 0x05D1, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39934
          std::vector<uint32_t> const cps = { 0x05D0, 0x2680, 0x005B, 0x0028, 0x2681, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 1, 1, 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39935
          std::vector<uint32_t> const cps = { 0x05D0, 0x2680, 0x005B, 0x0028, 0x2681, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39936
          std::vector<uint32_t> const cps = { 0x05D0, 0x2680, 0x005B, 0x0028, 0x0029, 0x2681, 0x05D1 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 1, 1, 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39937
          std::vector<uint32_t> const cps = { 0x05D0, 0x2680, 0x005B, 0x0028, 0x0029, 0x2681, 0x05D1 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39938
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x2680, 0x0028, 0x2681, 0x05D1, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 1, 1, 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39939
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x2680, 0x0028, 0x2681, 0x05D1, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39940
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x2680, 0x0028, 0x2681, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 1, 1, 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39941
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x2680, 0x0028, 0x2681, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39942
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x2680, 0x0028, 0x0029, 0x2681, 0x05D1 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 1, 1, 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_057_004)
  {
  
      {
          // line 39943
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x2680, 0x0028, 0x0029, 0x2681, 0x05D1 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39944
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0028, 0x2680, 0x0029, 0x2681, 0x05D1 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 1, 1, 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39945
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0028, 0x2680, 0x0029, 0x2681, 0x05D1 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39946
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x2680, 0x0028, 0x2681, 0x05D1, 0x0029 };
          std::vector<int> const expected_levels =
              { 0, 1, 1, 1, 1, 1, 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, 6, 5, 4, 3, 2, 1 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39947
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x2680, 0x0028, 0x2681, 0x05D1, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39948
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x2680, 0x0028, 0x2681, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 0, 1, 1, 1, 1, 1, 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, 6, 5, 4, 3, 2, 1 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39949
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x2680, 0x0028, 0x2681, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39950
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x2680, 0x0028, 0x0029, 0x2681, 0x05D1 };
          std::vector<int> const expected_levels =
              { 0, 1, 1, 1, 1, 1, 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, 6, 5, 4, 3, 2, 1 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39951
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x2680, 0x0028, 0x0029, 0x2681, 0x05D1 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39952
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0028, 0x2680, 0x0029, 0x2681, 0x05D1 };
          std::vector<int> const expected_levels =
              { 0, 1, 1, 1, 1, 1, 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, 6, 5, 4, 3, 2, 1 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_057_005)
  {
  
      {
          // line 39953
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0028, 0x2680, 0x0029, 0x2681, 0x05D1 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39954
          std::vector<uint32_t> const cps = { 0x005B, 0x0028, 0x05D0, 0x2680, 0x0029, 0x2681, 0x05D1 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39955
          std::vector<uint32_t> const cps = { 0x005B, 0x0028, 0x05D0, 0x2680, 0x0029, 0x2681, 0x05D1 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39958
          std::vector<uint32_t> const cps = { 0x05D0, 0x2680, 0x005B, 0x0061, 0x2681, 0x0028, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39959
          std::vector<uint32_t> const cps = { 0x05D0, 0x2680, 0x005B, 0x0061, 0x2681, 0x0028, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39960
          std::vector<uint32_t> const cps = { 0x05D0, 0x2680, 0x005B, 0x0061, 0x0028, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39961
          std::vector<uint32_t> const cps = { 0x05D0, 0x2680, 0x005B, 0x0061, 0x0028, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39962
          std::vector<uint32_t> const cps = { 0x05D0, 0x2680, 0x005B, 0x0061, 0x0028, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39963
          std::vector<uint32_t> const cps = { 0x05D0, 0x2680, 0x005B, 0x0061, 0x0028, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39964
          std::vector<uint32_t> const cps = { 0x05D0, 0x2680, 0x005B, 0x0028, 0x0061, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_057_006)
  {
  
      {
          // line 39965
          std::vector<uint32_t> const cps = { 0x05D0, 0x2680, 0x005B, 0x0028, 0x0061, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39966
          std::vector<uint32_t> const cps = { 0x05D0, 0x2680, 0x005B, 0x0028, 0x0061, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39967
          std::vector<uint32_t> const cps = { 0x05D0, 0x2680, 0x005B, 0x0028, 0x0061, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39968
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x2680, 0x0061, 0x2681, 0x0028, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39969
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x2680, 0x0061, 0x2681, 0x0028, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39970
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x2680, 0x0061, 0x0028, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39971
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x2680, 0x0061, 0x0028, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39972
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x2680, 0x0061, 0x0028, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39973
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x2680, 0x0061, 0x0028, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39974
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x2680, 0x0028, 0x0061, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_057_007)
  {
  
      {
          // line 39975
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x2680, 0x0028, 0x0061, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39976
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x2680, 0x0028, 0x0061, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39977
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x2680, 0x0028, 0x0061, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39978
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0028, 0x2680, 0x0061, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39979
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0028, 0x2680, 0x0061, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39980
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0028, 0x2680, 0x0061, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39981
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0028, 0x2680, 0x0061, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39982
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x2680, 0x0061, 0x2681, 0x0028, 0x0029 };
          std::vector<int> const expected_levels =
              { 0, 1, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39983
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x2680, 0x0061, 0x2681, 0x0028, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39984
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x2680, 0x0061, 0x0028, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 0, 1, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_057_008)
  {
  
      {
          // line 39985
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x2680, 0x0061, 0x0028, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39986
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x2680, 0x0061, 0x0028, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 0, 1, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39987
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x2680, 0x0061, 0x0028, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39988
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x2680, 0x0028, 0x0061, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 0, 1, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39989
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x2680, 0x0028, 0x0061, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39990
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x2680, 0x0028, 0x0061, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 0, 1, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39991
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x2680, 0x0028, 0x0061, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39992
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0028, 0x2680, 0x0061, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 0, 1, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39993
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0028, 0x2680, 0x0061, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39994
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0028, 0x2680, 0x0061, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 0, 1, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_057_009)
  {
  
      {
          // line 39995
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0028, 0x2680, 0x0061, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39996
          std::vector<uint32_t> const cps = { 0x005B, 0x0028, 0x05D0, 0x2680, 0x0061, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39997
          std::vector<uint32_t> const cps = { 0x005B, 0x0028, 0x05D0, 0x2680, 0x0061, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39998
          std::vector<uint32_t> const cps = { 0x005B, 0x0028, 0x05D0, 0x2680, 0x0061, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 39999
          std::vector<uint32_t> const cps = { 0x005B, 0x0028, 0x05D0, 0x2680, 0x0061, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40002
          std::vector<uint32_t> const cps = { 0x05D0, 0x2680, 0x005B, 0x0061, 0x0028, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40003
          std::vector<uint32_t> const cps = { 0x05D0, 0x2680, 0x005B, 0x0061, 0x0028, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 2, 2, 2 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 3, 4, 5, 6, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40004
          std::vector<uint32_t> const cps = { 0x05D0, 0x2680, 0x005B, 0x0061, 0x0028, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40005
          std::vector<uint32_t> const cps = { 0x05D0, 0x2680, 0x005B, 0x0061, 0x0028, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 2, 2, 2 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 3, 4, 5, 6, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40006
          std::vector<uint32_t> const cps = { 0x05D0, 0x2680, 0x005B, 0x0028, 0x0061, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_057_010)
  {
  
      {
          // line 40007
          std::vector<uint32_t> const cps = { 0x05D0, 0x2680, 0x005B, 0x0028, 0x0061, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40008
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x2680, 0x0061, 0x0028, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40009
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x2680, 0x0061, 0x0028, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 2, 2, 2 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 3, 4, 5, 6, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40010
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x2680, 0x0061, 0x0028, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40011
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x2680, 0x0061, 0x0028, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 2, 2, 2 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 3, 4, 5, 6, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40012
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x2680, 0x0028, 0x0061, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40013
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x2680, 0x0028, 0x0061, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40014
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0028, 0x2680, 0x0061, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40015
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0028, 0x2680, 0x0061, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40016
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x2680, 0x0061, 0x0028, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 0, 1, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_057_011)
  {
  
      {
          // line 40017
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x2680, 0x0061, 0x0028, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 2, 2, 2 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 3, 4, 5, 6, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40018
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x2680, 0x0061, 0x0028, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 0, 1, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40019
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x2680, 0x0061, 0x0028, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 2, 2, 2 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 3, 4, 5, 6, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40020
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x2680, 0x0028, 0x0061, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 0, 1, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40021
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x2680, 0x0028, 0x0061, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40022
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0028, 0x2680, 0x0061, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 0, 1, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40023
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0028, 0x2680, 0x0061, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40024
          std::vector<uint32_t> const cps = { 0x005B, 0x0028, 0x05D0, 0x2680, 0x0061, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40025
          std::vector<uint32_t> const cps = { 0x005B, 0x0028, 0x05D0, 0x2680, 0x0061, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40028
          std::vector<uint32_t> const cps = { 0x05D0, 0x2680, 0x005B, 0x0061, 0x05D1, 0x0028, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_057_012)
  {
  
      {
          // line 40029
          std::vector<uint32_t> const cps = { 0x05D0, 0x2680, 0x005B, 0x0061, 0x05D1, 0x0028, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40030
          std::vector<uint32_t> const cps = { 0x05D0, 0x2680, 0x005B, 0x0061, 0x0028, 0x05D1, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40031
          std::vector<uint32_t> const cps = { 0x05D0, 0x2680, 0x005B, 0x0061, 0x0028, 0x05D1, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40032
          std::vector<uint32_t> const cps = { 0x05D0, 0x2680, 0x005B, 0x0061, 0x0028, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40033
          std::vector<uint32_t> const cps = { 0x05D0, 0x2680, 0x005B, 0x0061, 0x0028, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40034
          std::vector<uint32_t> const cps = { 0x05D0, 0x2680, 0x005B, 0x0028, 0x0061, 0x05D1, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40035
          std::vector<uint32_t> const cps = { 0x05D0, 0x2680, 0x005B, 0x0028, 0x0061, 0x05D1, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40036
          std::vector<uint32_t> const cps = { 0x05D0, 0x2680, 0x005B, 0x0028, 0x0061, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40037
          std::vector<uint32_t> const cps = { 0x05D0, 0x2680, 0x005B, 0x0028, 0x0061, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40038
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x2680, 0x0061, 0x05D1, 0x0028, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_057_013)
  {
  
      {
          // line 40039
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x2680, 0x0061, 0x05D1, 0x0028, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40040
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x2680, 0x0061, 0x0028, 0x05D1, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40041
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x2680, 0x0061, 0x0028, 0x05D1, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40042
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x2680, 0x0061, 0x0028, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40043
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x2680, 0x0061, 0x0028, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40044
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x2680, 0x0028, 0x0061, 0x05D1, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40045
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x2680, 0x0028, 0x0061, 0x05D1, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40046
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x2680, 0x0028, 0x0061, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40047
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x2680, 0x0028, 0x0061, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40048
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0028, 0x2680, 0x0061, 0x05D1, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_057_014)
  {
  
      {
          // line 40049
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0028, 0x2680, 0x0061, 0x05D1, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40050
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0028, 0x2680, 0x0061, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40051
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0028, 0x2680, 0x0061, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40052
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x2680, 0x0061, 0x05D1, 0x0028, 0x0029 };
          std::vector<int> const expected_levels =
              { 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40053
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x2680, 0x0061, 0x05D1, 0x0028, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40054
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x2680, 0x0061, 0x0028, 0x05D1, 0x0029 };
          std::vector<int> const expected_levels =
              { 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40055
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x2680, 0x0061, 0x0028, 0x05D1, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40056
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x2680, 0x0061, 0x0028, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40057
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x2680, 0x0061, 0x0028, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40058
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x2680, 0x0028, 0x0061, 0x05D1, 0x0029 };
          std::vector<int> const expected_levels =
              { 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_057_015)
  {
  
      {
          // line 40059
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x2680, 0x0028, 0x0061, 0x05D1, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40060
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x2680, 0x0028, 0x0061, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40061
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x2680, 0x0028, 0x0061, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40062
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0028, 0x2680, 0x0061, 0x05D1, 0x0029 };
          std::vector<int> const expected_levels =
              { 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40063
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0028, 0x2680, 0x0061, 0x05D1, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40064
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0028, 0x2680, 0x0061, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40065
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0028, 0x2680, 0x0061, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40066
          std::vector<uint32_t> const cps = { 0x005B, 0x0028, 0x05D0, 0x2680, 0x0061, 0x05D1, 0x0029 };
          std::vector<int> const expected_levels =
              { 0, 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40067
          std::vector<uint32_t> const cps = { 0x005B, 0x0028, 0x05D0, 0x2680, 0x0061, 0x05D1, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40068
          std::vector<uint32_t> const cps = { 0x005B, 0x0028, 0x05D0, 0x2680, 0x0061, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_057_016)
  {
  
      {
          // line 40069
          std::vector<uint32_t> const cps = { 0x005B, 0x0028, 0x05D0, 0x2680, 0x0061, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40072
          std::vector<uint32_t> const cps = { 0x05D0, 0x2680, 0x005B, 0x05D1, 0x2681, 0x0028, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 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 =
              { 3, 2, 1, 0, 4, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40073
          std::vector<uint32_t> const cps = { 0x05D0, 0x2680, 0x005B, 0x05D1, 0x2681, 0x0028, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40074
          std::vector<uint32_t> const cps = { 0x05D0, 0x2680, 0x005B, 0x05D1, 0x0028, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 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 =
              { 3, 2, 1, 0, 4, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40075
          std::vector<uint32_t> const cps = { 0x05D0, 0x2680, 0x005B, 0x05D1, 0x0028, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40076
          std::vector<uint32_t> const cps = { 0x05D0, 0x2680, 0x005B, 0x05D1, 0x0028, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 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 =
              { 3, 2, 1, 0, 4, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40077
          std::vector<uint32_t> const cps = { 0x05D0, 0x2680, 0x005B, 0x05D1, 0x0028, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40078
          std::vector<uint32_t> const cps = { 0x05D0, 0x2680, 0x005B, 0x0028, 0x05D1, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 1, 1, 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40079
          std::vector<uint32_t> const cps = { 0x05D0, 0x2680, 0x005B, 0x0028, 0x05D1, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40080
          std::vector<uint32_t> const cps = { 0x05D0, 0x2680, 0x005B, 0x0028, 0x05D1, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 5, 4, 3, 2, 1, 0, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_057_017)
  {
  
      {
          // line 40081
          std::vector<uint32_t> const cps = { 0x05D0, 0x2680, 0x005B, 0x0028, 0x05D1, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40082
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x2680, 0x05D1, 0x2681, 0x0028, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 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 =
              { 3, 2, 1, 0, 4, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40083
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x2680, 0x05D1, 0x2681, 0x0028, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40084
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x2680, 0x05D1, 0x0028, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 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 =
              { 3, 2, 1, 0, 4, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40085
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x2680, 0x05D1, 0x0028, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40086
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x2680, 0x05D1, 0x0028, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 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 =
              { 3, 2, 1, 0, 4, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40087
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x2680, 0x05D1, 0x0028, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40088
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x2680, 0x0028, 0x05D1, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 1, 1, 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40089
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x2680, 0x0028, 0x05D1, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40090
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x2680, 0x0028, 0x05D1, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 5, 4, 3, 2, 1, 0, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_057_018)
  {
  
      {
          // line 40091
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x2680, 0x0028, 0x05D1, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40092
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0028, 0x2680, 0x05D1, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 1, 1, 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40093
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0028, 0x2680, 0x05D1, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40094
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0028, 0x2680, 0x05D1, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 5, 4, 3, 2, 1, 0, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40095
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0028, 0x2680, 0x05D1, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40096
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x2680, 0x05D1, 0x2681, 0x0028, 0x0029 };
          std::vector<int> const expected_levels =
              { 0, 1, 1, 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, 3, 2, 1, 4, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40097
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x2680, 0x05D1, 0x2681, 0x0028, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40098
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x2680, 0x05D1, 0x0028, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 0, 1, 1, 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, 3, 2, 1, 4, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40099
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x2680, 0x05D1, 0x0028, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40100
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x2680, 0x05D1, 0x0028, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 0, 1, 1, 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, 3, 2, 1, 4, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_057_019)
  {
  
      {
          // line 40101
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x2680, 0x05D1, 0x0028, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40102
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x2680, 0x0028, 0x05D1, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 0, 1, 1, 1, 1, 1, 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, 6, 5, 4, 3, 2, 1 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40103
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x2680, 0x0028, 0x05D1, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40104
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x2680, 0x0028, 0x05D1, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 0, 1, 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, 5, 4, 3, 2, 1, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40105
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x2680, 0x0028, 0x05D1, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40106
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0028, 0x2680, 0x05D1, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 0, 1, 1, 1, 1, 1, 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, 6, 5, 4, 3, 2, 1 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40107
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0028, 0x2680, 0x05D1, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40108
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0028, 0x2680, 0x05D1, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 0, 1, 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, 5, 4, 3, 2, 1, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40109
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0028, 0x2680, 0x05D1, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40110
          std::vector<uint32_t> const cps = { 0x005B, 0x0028, 0x05D0, 0x2680, 0x05D1, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 0, 0, 1, 1, 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, 4, 3, 2, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_057_020)
  {
  
      {
          // line 40111
          std::vector<uint32_t> const cps = { 0x005B, 0x0028, 0x05D0, 0x2680, 0x05D1, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40112
          std::vector<uint32_t> const cps = { 0x005B, 0x0028, 0x05D0, 0x2680, 0x05D1, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 0, 0, 1, 1, 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, 4, 3, 2, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40113
          std::vector<uint32_t> const cps = { 0x005B, 0x0028, 0x05D0, 0x2680, 0x05D1, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40116
          std::vector<uint32_t> const cps = { 0x05D0, 0x2680, 0x005B, 0x05D1, 0x0061, 0x0028, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 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 =
              { 3, 2, 1, 0, 4, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40117
          std::vector<uint32_t> const cps = { 0x05D0, 0x2680, 0x005B, 0x05D1, 0x0061, 0x0028, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40118
          std::vector<uint32_t> const cps = { 0x05D0, 0x2680, 0x005B, 0x05D1, 0x0028, 0x0061, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 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 =
              { 3, 2, 1, 0, 4, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40119
          std::vector<uint32_t> const cps = { 0x05D0, 0x2680, 0x005B, 0x05D1, 0x0028, 0x0061, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40120
          std::vector<uint32_t> const cps = { 0x05D0, 0x2680, 0x005B, 0x05D1, 0x0028, 0x0029, 0x0061 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 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 =
              { 3, 2, 1, 0, 4, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40121
          std::vector<uint32_t> const cps = { 0x05D0, 0x2680, 0x005B, 0x05D1, 0x0028, 0x0029, 0x0061 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40122
          std::vector<uint32_t> const cps = { 0x05D0, 0x2680, 0x005B, 0x0028, 0x05D1, 0x0061, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_057_021)
  {
  
      {
          // line 40123
          std::vector<uint32_t> const cps = { 0x05D0, 0x2680, 0x005B, 0x0028, 0x05D1, 0x0061, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40124
          std::vector<uint32_t> const cps = { 0x05D0, 0x2680, 0x005B, 0x0028, 0x05D1, 0x0029, 0x0061 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 5, 4, 3, 2, 1, 0, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40125
          std::vector<uint32_t> const cps = { 0x05D0, 0x2680, 0x005B, 0x0028, 0x05D1, 0x0029, 0x0061 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40126
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x2680, 0x05D1, 0x0061, 0x0028, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 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 =
              { 3, 2, 1, 0, 4, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40127
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x2680, 0x05D1, 0x0061, 0x0028, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40128
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x2680, 0x05D1, 0x0028, 0x0061, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 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 =
              { 3, 2, 1, 0, 4, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40129
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x2680, 0x05D1, 0x0028, 0x0061, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40130
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x2680, 0x05D1, 0x0028, 0x0029, 0x0061 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 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 =
              { 3, 2, 1, 0, 4, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40131
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x2680, 0x05D1, 0x0028, 0x0029, 0x0061 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40132
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x2680, 0x0028, 0x05D1, 0x0061, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_057_022)
  {
  
      {
          // line 40133
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x2680, 0x0028, 0x05D1, 0x0061, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40134
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x2680, 0x0028, 0x05D1, 0x0029, 0x0061 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 5, 4, 3, 2, 1, 0, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40135
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x2680, 0x0028, 0x05D1, 0x0029, 0x0061 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40136
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0028, 0x2680, 0x05D1, 0x0061, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40137
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0028, 0x2680, 0x05D1, 0x0061, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40138
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0028, 0x2680, 0x05D1, 0x0029, 0x0061 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 5, 4, 3, 2, 1, 0, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40139
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0028, 0x2680, 0x05D1, 0x0029, 0x0061 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40140
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x2680, 0x05D1, 0x0061, 0x0028, 0x0029 };
          std::vector<int> const expected_levels =
              { 0, 1, 1, 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, 3, 2, 1, 4, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40141
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x2680, 0x05D1, 0x0061, 0x0028, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40142
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x2680, 0x05D1, 0x0028, 0x0061, 0x0029 };
          std::vector<int> const expected_levels =
              { 0, 1, 1, 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, 3, 2, 1, 4, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_057_023)
  {
  
      {
          // line 40143
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x2680, 0x05D1, 0x0028, 0x0061, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40144
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x2680, 0x05D1, 0x0028, 0x0029, 0x0061 };
          std::vector<int> const expected_levels =
              { 0, 1, 1, 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, 3, 2, 1, 4, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40145
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x2680, 0x05D1, 0x0028, 0x0029, 0x0061 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40146
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x2680, 0x0028, 0x05D1, 0x0061, 0x0029 };
          std::vector<int> const expected_levels =
              { 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40147
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x2680, 0x0028, 0x05D1, 0x0061, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40148
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x2680, 0x0028, 0x05D1, 0x0029, 0x0061 };
          std::vector<int> const expected_levels =
              { 0, 1, 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, 5, 4, 3, 2, 1, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40149
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x2680, 0x0028, 0x05D1, 0x0029, 0x0061 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40150
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0028, 0x2680, 0x05D1, 0x0061, 0x0029 };
          std::vector<int> const expected_levels =
              { 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40151
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0028, 0x2680, 0x05D1, 0x0061, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40152
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0028, 0x2680, 0x05D1, 0x0029, 0x0061 };
          std::vector<int> const expected_levels =
              { 0, 1, 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, 5, 4, 3, 2, 1, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_057_024)
  {
  
      {
          // line 40153
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0028, 0x2680, 0x05D1, 0x0029, 0x0061 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40154
          std::vector<uint32_t> const cps = { 0x005B, 0x0028, 0x05D0, 0x2680, 0x05D1, 0x0061, 0x0029 };
          std::vector<int> const expected_levels =
              { 0, 0, 1, 1, 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, 4, 3, 2, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40155
          std::vector<uint32_t> const cps = { 0x005B, 0x0028, 0x05D0, 0x2680, 0x05D1, 0x0061, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40156
          std::vector<uint32_t> const cps = { 0x005B, 0x0028, 0x05D0, 0x2680, 0x05D1, 0x0029, 0x0061 };
          std::vector<int> const expected_levels =
              { 0, 0, 1, 1, 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, 4, 3, 2, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40157
          std::vector<uint32_t> const cps = { 0x005B, 0x0028, 0x05D0, 0x2680, 0x05D1, 0x0029, 0x0061 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40160
          std::vector<uint32_t> const cps = { 0x05D0, 0x2680, 0x005B, 0x05D1, 0x0028, 0x05D2, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 1, 1, 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40161
          std::vector<uint32_t> const cps = { 0x05D0, 0x2680, 0x005B, 0x05D1, 0x0028, 0x05D2, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40162
          std::vector<uint32_t> const cps = { 0x05D0, 0x2680, 0x005B, 0x05D1, 0x0028, 0x0029, 0x05D2 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 1, 1, 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40163
          std::vector<uint32_t> const cps = { 0x05D0, 0x2680, 0x005B, 0x05D1, 0x0028, 0x0029, 0x05D2 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40164
          std::vector<uint32_t> const cps = { 0x05D0, 0x2680, 0x005B, 0x0028, 0x05D1, 0x0029, 0x05D2 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 1, 1, 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_057_025)
  {
  
      {
          // line 40165
          std::vector<uint32_t> const cps = { 0x05D0, 0x2680, 0x005B, 0x0028, 0x05D1, 0x0029, 0x05D2 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40166
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x2680, 0x05D1, 0x0028, 0x05D2, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 1, 1, 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40167
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x2680, 0x05D1, 0x0028, 0x05D2, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40168
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x2680, 0x05D1, 0x0028, 0x0029, 0x05D2 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 1, 1, 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40169
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x2680, 0x05D1, 0x0028, 0x0029, 0x05D2 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40170
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x2680, 0x0028, 0x05D1, 0x0029, 0x05D2 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 1, 1, 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40171
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x2680, 0x0028, 0x05D1, 0x0029, 0x05D2 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40172
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0028, 0x2680, 0x05D1, 0x0029, 0x05D2 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 1, 1, 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40173
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0028, 0x2680, 0x05D1, 0x0029, 0x05D2 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40174
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x2680, 0x05D1, 0x0028, 0x05D2, 0x0029 };
          std::vector<int> const expected_levels =
              { 0, 1, 1, 1, 1, 1, 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, 6, 5, 4, 3, 2, 1 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_057_026)
  {
  
      {
          // line 40175
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x2680, 0x05D1, 0x0028, 0x05D2, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40176
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x2680, 0x05D1, 0x0028, 0x0029, 0x05D2 };
          std::vector<int> const expected_levels =
              { 0, 1, 1, 1, 1, 1, 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, 6, 5, 4, 3, 2, 1 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40177
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x2680, 0x05D1, 0x0028, 0x0029, 0x05D2 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40178
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x2680, 0x0028, 0x05D1, 0x0029, 0x05D2 };
          std::vector<int> const expected_levels =
              { 0, 1, 1, 1, 1, 1, 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, 6, 5, 4, 3, 2, 1 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40179
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x2680, 0x0028, 0x05D1, 0x0029, 0x05D2 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40180
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0028, 0x2680, 0x05D1, 0x0029, 0x05D2 };
          std::vector<int> const expected_levels =
              { 0, 1, 1, 1, 1, 1, 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, 6, 5, 4, 3, 2, 1 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40181
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0028, 0x2680, 0x05D1, 0x0029, 0x05D2 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40182
          std::vector<uint32_t> const cps = { 0x005B, 0x0028, 0x05D0, 0x2680, 0x05D1, 0x0029, 0x05D2 };
          std::vector<int> const expected_levels =
              { 0, 0, 1, 1, 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, 4, 3, 2, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40183
          std::vector<uint32_t> const cps = { 0x005B, 0x0028, 0x05D0, 0x2680, 0x05D1, 0x0029, 0x05D2 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40186
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0061, 0x2680, 0x0028, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_057_027)
  {
  
      {
          // line 40187
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0061, 0x2680, 0x0028, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40188
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0061, 0x2680, 0x0028, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40189
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0061, 0x2680, 0x0028, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40190
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0061, 0x0028, 0x2680, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40191
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0061, 0x0028, 0x2680, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40192
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0028, 0x0061, 0x2680, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40193
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0028, 0x0061, 0x2680, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40194
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0061, 0x2680, 0x0028, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 0, 1, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40195
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0061, 0x2680, 0x0028, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40196
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0061, 0x2680, 0x0028, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 0, 1, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_057_028)
  {
  
      {
          // line 40197
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0061, 0x2680, 0x0028, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40198
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0061, 0x0028, 0x2680, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 0, 1, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40199
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0061, 0x0028, 0x2680, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40200
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0028, 0x0061, 0x2680, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 0, 1, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40201
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0028, 0x0061, 0x2680, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40202
          std::vector<uint32_t> const cps = { 0x005B, 0x0028, 0x05D0, 0x0061, 0x2680, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40203
          std::vector<uint32_t> const cps = { 0x005B, 0x0028, 0x05D0, 0x0061, 0x2680, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40206
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0061, 0x2680, 0x0062, 0x0028, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40207
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0061, 0x2680, 0x0062, 0x0028, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 40208
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0061, 0x2680, 0x0028, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_057_029)
  {
  
      {
          // line 40209
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0061, 0x2680, 0x0028, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 2, 2, 2, 2 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 2, 3, 4, 5, 6, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40210
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0061, 0x2680, 0x0028, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40211
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0061, 0x2680, 0x0028, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 2, 2, 2, 2 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 2, 3, 4, 5, 6, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40212
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0061, 0x0028, 0x2680, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40213
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0061, 0x0028, 0x2680, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 2, 2, 2, 2 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 2, 3, 4, 5, 6, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40214
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0061, 0x0028, 0x2680, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40215
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0061, 0x0028, 0x2680, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 2, 2, 2, 2 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 2, 3, 4, 5, 6, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40216
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0061, 0x0028, 0x0029, 0x2680, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40217
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0061, 0x0028, 0x0029, 0x2680, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 2, 2, 2, 2 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 2, 3, 4, 5, 6, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40218
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0028, 0x0061, 0x2680, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_057_030)
  {
  
      {
          // line 40219
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0028, 0x0061, 0x2680, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 40220
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0028, 0x0061, 0x2680, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40221
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0028, 0x0061, 0x2680, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40222
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0028, 0x0061, 0x0029, 0x2680, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40223
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0028, 0x0061, 0x0029, 0x2680, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40224
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0061, 0x2680, 0x0062, 0x0028, 0x0029 };
          std::vector<int> const expected_levels =
              { 0, 1, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40225
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0061, 0x2680, 0x0062, 0x0028, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 40226
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0061, 0x2680, 0x0028, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 0, 1, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40227
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0061, 0x2680, 0x0028, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 2, 2, 2, 2 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 2, 3, 4, 5, 6, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40228
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0061, 0x2680, 0x0028, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 0, 1, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_057_031)
  {
  
      {
          // line 40229
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0061, 0x2680, 0x0028, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 2, 2, 2, 2 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 2, 3, 4, 5, 6, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40230
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0061, 0x0028, 0x2680, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 0, 1, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40231
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0061, 0x0028, 0x2680, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 2, 2, 2, 2 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 2, 3, 4, 5, 6, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40232
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0061, 0x0028, 0x2680, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 0, 1, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40233
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0061, 0x0028, 0x2680, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 2, 2, 2, 2 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 2, 3, 4, 5, 6, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40234
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0061, 0x0028, 0x0029, 0x2680, 0x0062 };
          std::vector<int> const expected_levels =
              { 0, 1, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40235
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0061, 0x0028, 0x0029, 0x2680, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 2, 2, 2, 2 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 2, 3, 4, 5, 6, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40236
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0028, 0x0061, 0x2680, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 0, 1, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40237
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0028, 0x0061, 0x2680, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 40238
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0028, 0x0061, 0x2680, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 0, 1, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_057_032)
  {
  
      {
          // line 40239
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0028, 0x0061, 0x2680, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40240
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0028, 0x0061, 0x0029, 0x2680, 0x0062 };
          std::vector<int> const expected_levels =
              { 0, 1, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40241
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0028, 0x0061, 0x0029, 0x2680, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40242
          std::vector<uint32_t> const cps = { 0x005B, 0x0028, 0x05D0, 0x0061, 0x2680, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40243
          std::vector<uint32_t> const cps = { 0x005B, 0x0028, 0x05D0, 0x0061, 0x2680, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 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 40244
          std::vector<uint32_t> const cps = { 0x005B, 0x0028, 0x05D0, 0x0061, 0x2680, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40245
          std::vector<uint32_t> const cps = { 0x005B, 0x0028, 0x05D0, 0x0061, 0x2680, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40246
          std::vector<uint32_t> const cps = { 0x005B, 0x0028, 0x05D0, 0x0061, 0x0029, 0x2680, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40247
          std::vector<uint32_t> const cps = { 0x005B, 0x0028, 0x05D0, 0x0061, 0x0029, 0x2680, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40250
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0061, 0x2680, 0x05D1, 0x0028, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_057_033)
  {
  
      {
          // line 40251
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0061, 0x2680, 0x05D1, 0x0028, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40252
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0061, 0x2680, 0x0028, 0x05D1, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40253
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0061, 0x2680, 0x0028, 0x05D1, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40254
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0061, 0x2680, 0x0028, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40255
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0061, 0x2680, 0x0028, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40256
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0061, 0x0028, 0x2680, 0x05D1, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40257
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0061, 0x0028, 0x2680, 0x05D1, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40258
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0061, 0x0028, 0x2680, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40259
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0061, 0x0028, 0x2680, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40260
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0061, 0x0028, 0x0029, 0x2680, 0x05D1 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_057_034)
  {
  
      {
          // line 40261
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0061, 0x0028, 0x0029, 0x2680, 0x05D1 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40262
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0028, 0x0061, 0x2680, 0x05D1, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40263
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0028, 0x0061, 0x2680, 0x05D1, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40264
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0028, 0x0061, 0x2680, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40265
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0028, 0x0061, 0x2680, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40266
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0028, 0x0061, 0x0029, 0x2680, 0x05D1 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40267
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0028, 0x0061, 0x0029, 0x2680, 0x05D1 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40268
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0061, 0x2680, 0x05D1, 0x0028, 0x0029 };
          std::vector<int> const expected_levels =
              { 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40269
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0061, 0x2680, 0x05D1, 0x0028, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40270
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0061, 0x2680, 0x0028, 0x05D1, 0x0029 };
          std::vector<int> const expected_levels =
              { 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_057_035)
  {
  
      {
          // line 40271
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0061, 0x2680, 0x0028, 0x05D1, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40272
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0061, 0x2680, 0x0028, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40273
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0061, 0x2680, 0x0028, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40274
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0061, 0x0028, 0x2680, 0x05D1, 0x0029 };
          std::vector<int> const expected_levels =
              { 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40275
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0061, 0x0028, 0x2680, 0x05D1, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40276
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0061, 0x0028, 0x2680, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40277
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0061, 0x0028, 0x2680, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40278
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0061, 0x0028, 0x0029, 0x2680, 0x05D1 };
          std::vector<int> const expected_levels =
              { 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40279
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0061, 0x0028, 0x0029, 0x2680, 0x05D1 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40280
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0028, 0x0061, 0x2680, 0x05D1, 0x0029 };
          std::vector<int> const expected_levels =
              { 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_057_036)
  {
  
      {
          // line 40281
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0028, 0x0061, 0x2680, 0x05D1, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40282
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0028, 0x0061, 0x2680, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40283
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0028, 0x0061, 0x2680, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40284
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0028, 0x0061, 0x0029, 0x2680, 0x05D1 };
          std::vector<int> const expected_levels =
              { 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40285
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0028, 0x0061, 0x0029, 0x2680, 0x05D1 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40286
          std::vector<uint32_t> const cps = { 0x005B, 0x0028, 0x05D0, 0x0061, 0x2680, 0x05D1, 0x0029 };
          std::vector<int> const expected_levels =
              { 0, 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40287
          std::vector<uint32_t> const cps = { 0x005B, 0x0028, 0x05D0, 0x0061, 0x2680, 0x05D1, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40288
          std::vector<uint32_t> const cps = { 0x005B, 0x0028, 0x05D0, 0x0061, 0x2680, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40289
          std::vector<uint32_t> const cps = { 0x005B, 0x0028, 0x05D0, 0x0061, 0x2680, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40290
          std::vector<uint32_t> const cps = { 0x005B, 0x0028, 0x05D0, 0x0061, 0x0029, 0x2680, 0x05D1 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_057_037)
  {
  
      {
          // line 40291
          std::vector<uint32_t> const cps = { 0x005B, 0x0028, 0x05D0, 0x0061, 0x0029, 0x2680, 0x05D1 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40294
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0061, 0x0028, 0x0062, 0x2680, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40295
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0061, 0x0028, 0x0062, 0x2680, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 2, 2, 2, 2 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 2, 3, 4, 5, 6, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40296
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0061, 0x0028, 0x0062, 0x0029, 0x2680 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40297
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0061, 0x0028, 0x0062, 0x0029, 0x2680 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 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 40298
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0061, 0x0028, 0x0062, 0x2680, 0x0029 };
          std::vector<int> const expected_levels =
              { 0, 1, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40299
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0061, 0x0028, 0x0062, 0x2680, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 2, 2, 2, 2 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 2, 3, 4, 5, 6, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40300
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0061, 0x0028, 0x0062, 0x0029, 0x2680 };
          std::vector<int> const expected_levels =
              { 0, 1, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40301
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0061, 0x0028, 0x0062, 0x0029, 0x2680 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 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 40304
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0061, 0x0028, 0x0062, 0x0029, 0x0063 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_057_038)
  {
  
      {
          // line 40305
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0061, 0x0028, 0x0062, 0x0029, 0x0063 };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 2, 2, 2, 2 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 2, 3, 4, 5, 6, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40306
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0061, 0x0028, 0x0062, 0x0029, 0x0063 };
          std::vector<int> const expected_levels =
              { 0, 1, 0, 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3, 4, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40307
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0061, 0x0028, 0x0062, 0x0029, 0x0063 };
          std::vector<int> const expected_levels =
              { 1, 1, 2, 2, 2, 2, 2 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 2, 3, 4, 5, 6, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40310
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0061, 0x0028, 0x0062, 0x05D1, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40311
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0061, 0x0028, 0x0062, 0x05D1, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40312
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0061, 0x0028, 0x0062, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40313
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0061, 0x0028, 0x0062, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 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 40314
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0061, 0x0028, 0x0062, 0x05D1, 0x0029 };
          std::vector<int> const expected_levels =
              { 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40315
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0061, 0x0028, 0x0062, 0x05D1, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40316
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0061, 0x0028, 0x0062, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_057_039)
  {
  
      {
          // line 40317
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0061, 0x0028, 0x0062, 0x0029, 0x05D1 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 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 40320
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0061, 0x05D1, 0x2680, 0x0028, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40321
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0061, 0x05D1, 0x2680, 0x0028, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40322
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0061, 0x05D1, 0x0028, 0x2680, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40323
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0061, 0x05D1, 0x0028, 0x2680, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40324
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0061, 0x05D1, 0x0028, 0x0029, 0x2680 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40325
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0061, 0x05D1, 0x0028, 0x0029, 0x2680 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40326
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0061, 0x0028, 0x05D1, 0x2680, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40327
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0061, 0x0028, 0x05D1, 0x2680, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40328
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0061, 0x0028, 0x05D1, 0x0029, 0x2680 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_057_040)
  {
  
      {
          // line 40329
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0061, 0x0028, 0x05D1, 0x0029, 0x2680 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40330
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0028, 0x0061, 0x05D1, 0x2680, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40331
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0028, 0x0061, 0x05D1, 0x2680, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40332
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0028, 0x0061, 0x05D1, 0x0029, 0x2680 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40333
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0028, 0x0061, 0x05D1, 0x0029, 0x2680 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40334
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0061, 0x05D1, 0x2680, 0x0028, 0x0029 };
          std::vector<int> const expected_levels =
              { 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40335
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0061, 0x05D1, 0x2680, 0x0028, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40336
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0061, 0x05D1, 0x0028, 0x2680, 0x0029 };
          std::vector<int> const expected_levels =
              { 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40337
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0061, 0x05D1, 0x0028, 0x2680, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40338
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0061, 0x05D1, 0x0028, 0x0029, 0x2680 };
          std::vector<int> const expected_levels =
              { 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_057_041)
  {
  
      {
          // line 40339
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0061, 0x05D1, 0x0028, 0x0029, 0x2680 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40340
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0061, 0x0028, 0x05D1, 0x2680, 0x0029 };
          std::vector<int> const expected_levels =
              { 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40341
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0061, 0x0028, 0x05D1, 0x2680, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40342
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0061, 0x0028, 0x05D1, 0x0029, 0x2680 };
          std::vector<int> const expected_levels =
              { 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40343
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0061, 0x0028, 0x05D1, 0x0029, 0x2680 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40344
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0028, 0x0061, 0x05D1, 0x2680, 0x0029 };
          std::vector<int> const expected_levels =
              { 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40345
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0028, 0x0061, 0x05D1, 0x2680, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40346
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0028, 0x0061, 0x05D1, 0x0029, 0x2680 };
          std::vector<int> const expected_levels =
              { 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40347
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0028, 0x0061, 0x05D1, 0x0029, 0x2680 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40348
          std::vector<uint32_t> const cps = { 0x005B, 0x0028, 0x05D0, 0x0061, 0x05D1, 0x2680, 0x0029 };
          std::vector<int> const expected_levels =
              { 0, 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_057_042)
  {
  
      {
          // line 40349
          std::vector<uint32_t> const cps = { 0x005B, 0x0028, 0x05D0, 0x0061, 0x05D1, 0x2680, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40350
          std::vector<uint32_t> const cps = { 0x005B, 0x0028, 0x05D0, 0x0061, 0x05D1, 0x0029, 0x2680 };
          std::vector<int> const expected_levels =
              { 0, 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40351
          std::vector<uint32_t> const cps = { 0x005B, 0x0028, 0x05D0, 0x0061, 0x05D1, 0x0029, 0x2680 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40354
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0061, 0x05D1, 0x0062, 0x0028, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40355
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0061, 0x05D1, 0x0062, 0x0028, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40356
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0061, 0x05D1, 0x0028, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40357
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0061, 0x05D1, 0x0028, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40358
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0061, 0x05D1, 0x0028, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40359
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0061, 0x05D1, 0x0028, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40360
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0061, 0x0028, 0x05D1, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_057_043)
  {
  
      {
          // line 40361
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0061, 0x0028, 0x05D1, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40362
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0061, 0x0028, 0x05D1, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40363
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0061, 0x0028, 0x05D1, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40364
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0028, 0x0061, 0x05D1, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40365
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0028, 0x0061, 0x05D1, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40366
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0028, 0x0061, 0x05D1, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40367
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0028, 0x0061, 0x05D1, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40368
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0061, 0x05D1, 0x0062, 0x0028, 0x0029 };
          std::vector<int> const expected_levels =
              { 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40369
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0061, 0x05D1, 0x0062, 0x0028, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40370
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0061, 0x05D1, 0x0028, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_057_044)
  {
  
      {
          // line 40371
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0061, 0x05D1, 0x0028, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40372
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0061, 0x05D1, 0x0028, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40373
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0061, 0x05D1, 0x0028, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40374
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0061, 0x0028, 0x05D1, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40375
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0061, 0x0028, 0x05D1, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40376
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0061, 0x0028, 0x05D1, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40377
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0061, 0x0028, 0x05D1, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40378
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0028, 0x0061, 0x05D1, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40379
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0028, 0x0061, 0x05D1, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40380
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0028, 0x0061, 0x05D1, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_057_045)
  {
  
      {
          // line 40381
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0028, 0x0061, 0x05D1, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40382
          std::vector<uint32_t> const cps = { 0x005B, 0x0028, 0x05D0, 0x0061, 0x05D1, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 0, 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40383
          std::vector<uint32_t> const cps = { 0x005B, 0x0028, 0x05D0, 0x0061, 0x05D1, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40384
          std::vector<uint32_t> const cps = { 0x005B, 0x0028, 0x05D0, 0x0061, 0x05D1, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 0, 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40385
          std::vector<uint32_t> const cps = { 0x005B, 0x0028, 0x05D0, 0x0061, 0x05D1, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40388
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0061, 0x05D1, 0x0028, 0x05D2, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 0, 0, 1, 1, 1, 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, 6, 5, 4, 3 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40389
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0061, 0x05D1, 0x0028, 0x05D2, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40390
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0061, 0x05D1, 0x0028, 0x0029, 0x05D2 };
          std::vector<int> const expected_levels =
              { 1, 0, 0, 1, 1, 1, 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, 6, 5, 4, 3 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40391
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0061, 0x05D1, 0x0028, 0x0029, 0x05D2 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40392
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0061, 0x0028, 0x05D1, 0x0029, 0x05D2 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_057_046)
  {
  
      {
          // line 40393
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0061, 0x0028, 0x05D1, 0x0029, 0x05D2 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40394
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0028, 0x0061, 0x05D1, 0x0029, 0x05D2 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40395
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0028, 0x0061, 0x05D1, 0x0029, 0x05D2 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40396
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0061, 0x05D1, 0x0028, 0x05D2, 0x0029 };
          std::vector<int> const expected_levels =
              { 0, 1, 0, 1, 1, 1, 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, 6, 5, 4, 3 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40397
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0061, 0x05D1, 0x0028, 0x05D2, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40398
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0061, 0x05D1, 0x0028, 0x0029, 0x05D2 };
          std::vector<int> const expected_levels =
              { 0, 1, 0, 1, 1, 1, 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, 6, 5, 4, 3 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40399
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0061, 0x05D1, 0x0028, 0x0029, 0x05D2 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40400
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0061, 0x0028, 0x05D1, 0x0029, 0x05D2 };
          std::vector<int> const expected_levels =
              { 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40401
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0061, 0x0028, 0x05D1, 0x0029, 0x05D2 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40402
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0028, 0x0061, 0x05D1, 0x0029, 0x05D2 };
          std::vector<int> const expected_levels =
              { 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_057_047)
  {
  
      {
          // line 40403
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0028, 0x0061, 0x05D1, 0x0029, 0x05D2 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40404
          std::vector<uint32_t> const cps = { 0x005B, 0x0028, 0x05D0, 0x0061, 0x05D1, 0x0029, 0x05D2 };
          std::vector<int> const expected_levels =
              { 0, 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40405
          std::vector<uint32_t> const cps = { 0x005B, 0x0028, 0x05D0, 0x0061, 0x05D1, 0x0029, 0x05D2 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40408
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x05D1, 0x2680, 0x0028, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 2, 1, 0, 3, 4, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40409
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x05D1, 0x2680, 0x0028, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40410
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x05D1, 0x2680, 0x0028, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 2, 1, 0, 3, 4, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40411
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x05D1, 0x2680, 0x0028, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40412
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x05D1, 0x0028, 0x2680, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 2, 1, 0, 3, 4, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40413
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x05D1, 0x0028, 0x2680, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40414
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0028, 0x05D1, 0x2680, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 5, 4, 3, 2, 1, 0, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_057_048)
  {
  
      {
          // line 40415
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0028, 0x05D1, 0x2680, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40416
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0028, 0x05D1, 0x2680, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 0, 1, 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, 5, 4, 3, 2, 1, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40417
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0028, 0x05D1, 0x2680, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40420
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x05D1, 0x2680, 0x0061, 0x0028, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 2, 1, 0, 3, 4, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40421
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x05D1, 0x2680, 0x0061, 0x0028, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40422
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x05D1, 0x2680, 0x0028, 0x0061, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 2, 1, 0, 3, 4, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40423
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x05D1, 0x2680, 0x0028, 0x0061, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40424
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x05D1, 0x2680, 0x0028, 0x0029, 0x0061 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 2, 1, 0, 3, 4, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40425
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x05D1, 0x2680, 0x0028, 0x0029, 0x0061 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40426
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x05D1, 0x0028, 0x2680, 0x0061, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 2, 1, 0, 3, 4, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_057_049)
  {
  
      {
          // line 40427
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x05D1, 0x0028, 0x2680, 0x0061, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40428
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x05D1, 0x0028, 0x2680, 0x0029, 0x0061 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 2, 1, 0, 3, 4, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40429
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x05D1, 0x0028, 0x2680, 0x0029, 0x0061 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40430
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x05D1, 0x0028, 0x0029, 0x2680, 0x0061 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 2, 1, 0, 3, 4, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40431
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x05D1, 0x0028, 0x0029, 0x2680, 0x0061 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40432
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0028, 0x05D1, 0x2680, 0x0061, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40433
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0028, 0x05D1, 0x2680, 0x0061, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40434
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0028, 0x05D1, 0x2680, 0x0029, 0x0061 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 5, 4, 3, 2, 1, 0, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40435
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0028, 0x05D1, 0x2680, 0x0029, 0x0061 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40436
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0028, 0x05D1, 0x0029, 0x2680, 0x0061 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 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 =
              { 4, 3, 2, 1, 0, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_057_050)
  {
  
      {
          // line 40437
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0028, 0x05D1, 0x0029, 0x2680, 0x0061 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40438
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0028, 0x05D1, 0x2680, 0x0061, 0x0029 };
          std::vector<int> const expected_levels =
              { 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40439
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0028, 0x05D1, 0x2680, 0x0061, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40440
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0028, 0x05D1, 0x2680, 0x0029, 0x0061 };
          std::vector<int> const expected_levels =
              { 0, 1, 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, 5, 4, 3, 2, 1, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40441
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0028, 0x05D1, 0x2680, 0x0029, 0x0061 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40442
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0028, 0x05D1, 0x0029, 0x2680, 0x0061 };
          std::vector<int> const expected_levels =
              { 0, 1, 1, 1, 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, 4, 3, 2, 1, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40443
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0028, 0x05D1, 0x0029, 0x2680, 0x0061 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40446
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x05D1, 0x2680, 0x05D2, 0x0028, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 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 =
              { 4, 3, 2, 1, 0, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40447
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x05D1, 0x2680, 0x05D2, 0x0028, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40448
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x05D1, 0x2680, 0x0028, 0x05D2, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 1, 1, 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_057_051)
  {
  
      {
          // line 40449
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x05D1, 0x2680, 0x0028, 0x05D2, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40450
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x05D1, 0x2680, 0x0028, 0x0029, 0x05D2 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 1, 1, 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40451
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x05D1, 0x2680, 0x0028, 0x0029, 0x05D2 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40452
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x05D1, 0x0028, 0x2680, 0x05D2, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 1, 1, 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40453
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x05D1, 0x0028, 0x2680, 0x05D2, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40454
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x05D1, 0x0028, 0x2680, 0x0029, 0x05D2 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 1, 1, 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40455
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x05D1, 0x0028, 0x2680, 0x0029, 0x05D2 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40456
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x05D1, 0x0028, 0x0029, 0x2680, 0x05D2 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 1, 1, 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40457
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x05D1, 0x0028, 0x0029, 0x2680, 0x05D2 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40458
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0028, 0x05D1, 0x2680, 0x05D2, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 1, 1, 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_057_052)
  {
  
      {
          // line 40459
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0028, 0x05D1, 0x2680, 0x05D2, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40460
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0028, 0x05D1, 0x2680, 0x0029, 0x05D2 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 1, 1, 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40461
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0028, 0x05D1, 0x2680, 0x0029, 0x05D2 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40462
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0028, 0x05D1, 0x0029, 0x2680, 0x05D2 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 1, 1, 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40463
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0028, 0x05D1, 0x0029, 0x2680, 0x05D2 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40464
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0028, 0x05D1, 0x2680, 0x05D2, 0x0029 };
          std::vector<int> const expected_levels =
              { 0, 1, 1, 1, 1, 1, 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, 6, 5, 4, 3, 2, 1 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40465
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0028, 0x05D1, 0x2680, 0x05D2, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40466
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0028, 0x05D1, 0x2680, 0x0029, 0x05D2 };
          std::vector<int> const expected_levels =
              { 0, 1, 1, 1, 1, 1, 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, 6, 5, 4, 3, 2, 1 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40467
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0028, 0x05D1, 0x2680, 0x0029, 0x05D2 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40468
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0028, 0x05D1, 0x0029, 0x2680, 0x05D2 };
          std::vector<int> const expected_levels =
              { 0, 1, 1, 1, 1, 1, 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, 6, 5, 4, 3, 2, 1 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_057_053)
  {
  
      {
          // line 40469
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0028, 0x05D1, 0x0029, 0x2680, 0x05D2 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40472
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x05D1, 0x0061, 0x2680, 0x0028, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 2, 1, 0, 3, 4, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40473
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x05D1, 0x0061, 0x2680, 0x0028, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40474
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x05D1, 0x0061, 0x0028, 0x2680, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 2, 1, 0, 3, 4, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40475
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x05D1, 0x0061, 0x0028, 0x2680, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40476
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x05D1, 0x0061, 0x0028, 0x0029, 0x2680 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 2, 1, 0, 3, 4, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40477
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x05D1, 0x0061, 0x0028, 0x0029, 0x2680 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40478
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x05D1, 0x0028, 0x0061, 0x2680, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 2, 1, 0, 3, 4, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40479
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x05D1, 0x0028, 0x0061, 0x2680, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40480
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x05D1, 0x0028, 0x0061, 0x0029, 0x2680 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 2, 1, 0, 3, 4, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_057_054)
  {
  
      {
          // line 40481
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x05D1, 0x0028, 0x0061, 0x0029, 0x2680 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40482
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0028, 0x05D1, 0x0061, 0x2680, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40483
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0028, 0x05D1, 0x0061, 0x2680, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40484
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0028, 0x05D1, 0x0061, 0x0029, 0x2680 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40485
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0028, 0x05D1, 0x0061, 0x0029, 0x2680 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40486
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0028, 0x05D1, 0x0061, 0x2680, 0x0029 };
          std::vector<int> const expected_levels =
              { 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40487
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0028, 0x05D1, 0x0061, 0x2680, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40488
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0028, 0x05D1, 0x0061, 0x0029, 0x2680 };
          std::vector<int> const expected_levels =
              { 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40489
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0028, 0x05D1, 0x0061, 0x0029, 0x2680 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40492
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x05D1, 0x0061, 0x0028, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 2, 1, 0, 3, 4, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_057_055)
  {
  
      {
          // line 40493
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x05D1, 0x0061, 0x0028, 0x0062, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 2, 2, 2 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 3, 4, 5, 6, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40494
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x05D1, 0x0061, 0x0028, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 2, 1, 0, 3, 4, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40495
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x05D1, 0x0061, 0x0028, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 2, 2, 2, 2 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 3, 4, 5, 6, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40496
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x05D1, 0x0028, 0x0061, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 2, 1, 0, 3, 4, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40497
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x05D1, 0x0028, 0x0061, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40498
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0028, 0x05D1, 0x0061, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40499
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0028, 0x05D1, 0x0061, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40500
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0028, 0x05D1, 0x0061, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40501
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0028, 0x05D1, 0x0061, 0x0029, 0x0062 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40504
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x05D1, 0x0061, 0x05D2, 0x0028, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 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 =
              { 2, 1, 0, 3, 4, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_057_056)
  {
  
      {
          // line 40505
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x05D1, 0x0061, 0x05D2, 0x0028, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40506
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x05D1, 0x0061, 0x0028, 0x05D2, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 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 =
              { 2, 1, 0, 3, 4, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40507
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x05D1, 0x0061, 0x0028, 0x05D2, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40508
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x05D1, 0x0061, 0x0028, 0x0029, 0x05D2 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 2, 1, 0, 3, 4, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40509
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x05D1, 0x0061, 0x0028, 0x0029, 0x05D2 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40510
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x05D1, 0x0028, 0x0061, 0x05D2, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 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 =
              { 2, 1, 0, 3, 4, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40511
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x05D1, 0x0028, 0x0061, 0x05D2, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40512
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x05D1, 0x0028, 0x0061, 0x0029, 0x05D2 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 2, 1, 0, 3, 4, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40513
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x05D1, 0x0028, 0x0061, 0x0029, 0x05D2 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40514
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0028, 0x05D1, 0x0061, 0x05D2, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_057_057)
  {
  
      {
          // line 40515
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0028, 0x05D1, 0x0061, 0x05D2, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40516
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0028, 0x05D1, 0x0061, 0x0029, 0x05D2 };
          std::vector<int> const expected_levels =
              { 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40517
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x0028, 0x05D1, 0x0061, 0x0029, 0x05D2 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40518
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0028, 0x05D1, 0x0061, 0x05D2, 0x0029 };
          std::vector<int> const expected_levels =
              { 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40519
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0028, 0x05D1, 0x0061, 0x05D2, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40520
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0028, 0x05D1, 0x0061, 0x0029, 0x05D2 };
          std::vector<int> const expected_levels =
              { 0, 1, 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40521
          std::vector<uint32_t> const cps = { 0x005B, 0x05D0, 0x0028, 0x05D1, 0x0061, 0x0029, 0x05D2 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40524
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x05D1, 0x0028, 0x05D2, 0x2680, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 1, 1, 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40525
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x05D1, 0x0028, 0x05D2, 0x2680, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40526
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x05D1, 0x0028, 0x05D2, 0x0029, 0x2680 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 5, 4, 3, 2, 1, 0, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_057_058)
  {
  
      {
          // line 40527
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x05D1, 0x0028, 0x05D2, 0x0029, 0x2680 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40530
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x05D1, 0x0028, 0x05D2, 0x0061, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 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 =
              { 2, 1, 0, 3, 4, 5, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40531
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x05D1, 0x0028, 0x05D2, 0x0061, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40532
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x05D1, 0x0028, 0x05D2, 0x0029, 0x0061 };
          std::vector<int> const expected_levels =
              { 1, 1, 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 =
              { 5, 4, 3, 2, 1, 0, 6 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40533
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x05D1, 0x0028, 0x05D2, 0x0029, 0x0061 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40536
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x05D1, 0x0028, 0x05D2, 0x0029, 0x05D3 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1, 1, 1, 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40537
          std::vector<uint32_t> const cps = { 0x05D0, 0x005B, 0x05D1, 0x0028, 0x05D2, 0x0029, 0x05D3 };
          std::vector<int> const expected_levels =
              { 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 =
              { 6, 5, 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40540
          std::vector<uint32_t> const cps = { 0x0028, 0x005B, 0x0029 };
          std::vector<int> const expected_levels =
              { 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40541
          std::vector<uint32_t> const cps = { 0x0028, 0x005B, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40544
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x005B, 0x0029 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_057_059)
  {
  
      {
          // line 40545
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x005B, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40546
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x005B, 0x0029 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40547
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x005B, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40548
          std::vector<uint32_t> const cps = { 0x0028, 0x005B, 0x2680, 0x0029 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40549
          std::vector<uint32_t> const cps = { 0x0028, 0x005B, 0x2680, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40550
          std::vector<uint32_t> const cps = { 0x0028, 0x005B, 0x0029, 0x2680 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40551
          std::vector<uint32_t> const cps = { 0x0028, 0x005B, 0x0029, 0x2680 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40554
          std::vector<uint32_t> const cps = { 0x0061, 0x0028, 0x005B, 0x0029 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40555
          std::vector<uint32_t> const cps = { 0x0061, 0x0028, 0x005B, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40556
          std::vector<uint32_t> const cps = { 0x0028, 0x0061, 0x005B, 0x0029 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_057_060)
  {
  
      {
          // line 40557
          std::vector<uint32_t> const cps = { 0x0028, 0x0061, 0x005B, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40558
          std::vector<uint32_t> const cps = { 0x0028, 0x005B, 0x0061, 0x0029 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40559
          std::vector<uint32_t> const cps = { 0x0028, 0x005B, 0x0061, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40560
          std::vector<uint32_t> const cps = { 0x0028, 0x005B, 0x0029, 0x0061 };
          std::vector<int> const expected_levels =
              { 0, 0, 0, 0 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 0);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 0, 1, 2, 3 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40561
          std::vector<uint32_t> const cps = { 0x0028, 0x005B, 0x0029, 0x0061 };
          std::vector<int> const expected_levels =
              { 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 =
              { 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40564
          std::vector<uint32_t> const cps = { 0x05D0, 0x0028, 0x005B, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40565
          std::vector<uint32_t> const cps = { 0x05D0, 0x0028, 0x005B, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40566
          std::vector<uint32_t> const cps = { 0x0028, 0x05D0, 0x005B, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40567
          std::vector<uint32_t> const cps = { 0x0028, 0x05D0, 0x005B, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40568
          std::vector<uint32_t> const cps = { 0x0028, 0x005B, 0x05D0, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_057_061)
  {
  
      {
          // line 40569
          std::vector<uint32_t> const cps = { 0x0028, 0x005B, 0x05D0, 0x0029 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40570
          std::vector<uint32_t> const cps = { 0x0028, 0x005B, 0x0029, 0x05D0 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40571
          std::vector<uint32_t> const cps = { 0x0028, 0x005B, 0x0029, 0x05D0 };
          std::vector<int> const expected_levels =
              { 1, 1, 1, 1 };
          std::vector<int> const levels =
              bidi_levels(cps.begin(), cps.end(), 1);
          int i = 0;
          for (int l : expected_levels) {
              if (0 <= l) {
                  EXPECT_EQ(levels[i], l) << "i=" << i;
                  ++i;
              }
          }
          EXPECT_EQ((int)levels.size(), i);
  
          std::vector<uint32_t> const expected_reordered_indices =
              { 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40574
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x2681, 0x005B, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40575
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x2681, 0x005B, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40576
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x005B, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40577
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x005B, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40578
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x005B, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40579
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x005B, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 =
              { 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40580
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x005B, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_057_062)
  {
  
      {
          // line 40581
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x005B, 0x2681, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40582
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x005B, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40583
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x005B, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 =
              { 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40584
          std::vector<uint32_t> const cps = { 0x0028, 0x005B, 0x2680, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40585
          std::vector<uint32_t> const cps = { 0x0028, 0x005B, 0x2680, 0x0029, 0x2681 };
          std::vector<int> const expected_levels =
              { 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 =
              { 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40588
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x005B, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40589
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x0061, 0x005B, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40590
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x005B, 0x0061, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40591
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x005B, 0x0061, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40592
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x005B, 0x0029, 0x0061 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int 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_057_063)
  {
  
      {
          // line 40593
          std::vector<uint32_t> const cps = { 0x2680, 0x0028, 0x005B, 0x0029, 0x0061 };
          std::vector<int> const expected_levels =
              { 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 =
              { 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40594
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x005B, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40595
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x0061, 0x005B, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40596
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x005B, 0x0061, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40597
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x005B, 0x0061, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 =
              { 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40598
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x005B, 0x0029, 0x0061 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40599
          std::vector<uint32_t> const cps = { 0x0028, 0x2680, 0x005B, 0x0029, 0x0061 };
          std::vector<int> const expected_levels =
              { 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 =
              { 4, 3, 2, 1, 0 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 1);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
      {
          // line 40600
          std::vector<uint32_t> const cps = { 0x0028, 0x005B, 0x2680, 0x0061, 0x0029 };
          std::vector<int> const expected_levels =
              { 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 };
          std::vector<int> const reordered =
              bidi_reordered_indices(cps.begin(), cps.end(), 0);
          i = 0;
          for (int idx : expected_reordered_indices) {
              EXPECT_EQ(reordered[i], (int)cps[idx])
                  << std::hex
                  << " 0x" << reordered[i]
                  << " 0x" << cps[idx]
                  << std::dec << " i=" << i;
              ++i;
          }
      }
  
  }
  