text:
namespace Google.Cloud.Dataplex.V1.Snippets
{
    // [START dataplex_v1_generated_DataplexService_CreateZone_sync]
    using Google.Cloud.Dataplex.V1;
    using Google.LongRunning;

    public sealed partial class GeneratedDataplexServiceClientSnippets
    {
        /// <summary>Snippet for CreateZone</summary>
        /// <remarks>
        /// This snippet has been automatically generated and should be regarded as a code template only.
        /// It will require modifications to work:
        /// - It may require correct/in-range values for request initialization.
        /// - It may require specifying regional endpoints when creating the service client as shown in
        ///   https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
        /// </remarks>
        public void CreateZoneRequestObject()
        {
            // Create client
            DataplexServiceClient dataplexServiceClient = DataplexServiceClient.Create();
            // Initialize request argument(s)
            CreateZoneRequest request = new CreateZoneRequest
            {
                ParentAsLakeName = LakeName.FromProjectLocationLake("[PROJECT]", "[LOCATION]", "[LAKE]"),
                ZoneId = "",
                Zone = new Zone(),
                ValidateOnly = false,
            };
            // Make the request
            Operation<Zone, OperationMetadata> response = dataplexServiceClient.CreateZone(request);

            // Poll until the returned long-running operation is complete
            Operation<Zone, OperationMetadata> completedResponse = response.PollUntilCompleted();
            // Retrieve the operation result
            Zone result = completedResponse.Result;

            // Or get the name of the operation
            string operationName = response.Name;
            // This name can be stored, then the long-running operation retrieved later by name
            Operation<Zone, OperationMetadata> retrievedResponse = dataplexServiceClient.PollOnceCreateZone(operationName);
            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                Zone retrievedResult = retrievedResponse.Result;
            }
        }
    }
    // [END dataplex_v1_generated_DataplexService_CreateZone_sync]
}

redpajama_set_name: RedPajamaGithub


text:
int main() {
  // Initialise the GLFW framework.
  glfwInit();
  glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);

  // Make a window
  const char *title = "threaded";
  auto glfwwindow = glfwCreateWindow(800, 800, title,  nullptr, nullptr);

  // Initialize makers
  vku::InstanceMaker im{};
  im.defaultLayers();
  vku::DeviceMaker dm{};
  dm.defaultLayers();

  // Initialise the Vookoo demo framework.
  vku::Framework fw{im, dm};
  if (!fw.ok()) {
    std::cout << "Framework creation failed" << std::endl;
    exit(1);
  }

  // Create a window to draw into
  vku::Window window{
    fw.instance(),
    fw.device(),
    fw.physicalDevice(),
    fw.graphicsQueueFamilyIndex(),
    glfwwindow
  };
  if (!window.ok()) {
    std::cout << "Window creation failed" << std::endl;
    exit(1);
  }
  window.clearColorValue() = {0.55f, 0.65f, 0.75f, 1.0f};

  // Create two shaders, vertex and fragment.
  vku::ShaderModule vert{fw.device(), BINARY_DIR "threaded.vert.spv"};
  vku::ShaderModule frag{fw.device(), BINARY_DIR "threaded.frag.spv"};

  // These are the parameters we are passing to the shaders
  // Note! be very careful when using vec3, vec2, float and vec4 together
  // as there are alignment rules you must follow.
  struct PushConstant {
    glm::vec4 colour;
    glm::mat4 transform;
  };

  // Define N distinct objects by their colour and transform (using push constants).
  const int N = 105;
  std::vector<PushConstant> P;
  for(int n=0; n<N; ++n) {
    P.emplace_back(
      PushConstant{
        .colour = glm::vec4{1},
        .transform = glm::translate(glm::vec3(0.0f,0.0f,1.0f-n/float(N))) * glm::scale(glm::vec3(1.0f-n/float(N)))
      }
    );
  }

  // We will use this simple vertex description.
  // It has a 2D location (x, y) and a colour (r, g, b)
  struct Vertex {
    glm::vec2 pos;
    glm::vec3 colour;
  };

  // This is our triangle.
  const std::vector<Vertex> vertices = {
    {.pos={ 0.0f,-0.5f}, .colour={1.0f, 0.0f, 0.0f}},
    {.pos={ 0.5f, 0.5f}, .colour={0.0f, 1.0f, 0.0f}},
    {.pos={-0.5f, 0.5f}, .colour={0.0f, 0.0f, 1.0f}},
  };
  vku::HostVertexBuffer buffer(fw.device(), fw.memprops(), vertices);

  // Make a pipeline to use the vertex format and shaders.
  vku::PipelineMaker pm{window.width(), window.height()};
  pm.shader(vk::ShaderStageFlagBits::eVertex, vert)
    .shader(vk::ShaderStageFlagBits::eFragment, frag)
    .vertexBinding(0, sizeof(Vertex))
    .vertexAttribute(0, 0, vk::Format::eR32G32Sfloat, offsetof(Vertex, pos))
    .vertexAttribute(1, 0, vk::Format::eR32G32B32Sfloat, offsetof(Vertex, colour))
    .depthTestEnable(true);

  // Make a default pipeline layout. This shows how pointers
  // to resources are layed out.
  //
  vku::PipelineLayoutMaker plm{};
  plm.pushConstantRange(vk::ShaderStageFlagBits::eAll, 0, sizeof(PushConstant));
  auto pipelineLayout = plm.createUnique(fw.device());

  // Create a pipeline using a renderPass built for our window.
  auto pipeline = pm.createUnique(fw.device(), fw.pipelineCache(), *pipelineLayout, window.renderPass());

  // define number of threads
  const uint32_t Nthreads = std::thread::hardware_concurrency();
  std::cout << "Nthreads = " << Nthreads << std::endl;

  // allocate array of threads to be reused from frame to frame
  std::vector<std::thread> v( Nthreads );

  // allocate command pools and secondary buffers, required to be separate pools per thread
  std::vector<vk::UniqueCommandPool> scp;
  std::vector<std::vector<vk::UniqueCommandBuffer>> scb;
  for (int i=0; i<Nthreads; ++i) {
    // add pool
    scp.emplace_back(
      fw.device().createCommandPoolUnique(
        vk::CommandPoolCreateInfo{
          vk::CommandPoolCreateFlagBits::eResetCommandBuffer,
          fw.graphicsQueueFamilyIndex()
        }
      )
    );
    // add secondary command buffer(s) per pool
    scb.emplace_back(
      std::move(
        fw.device().allocateCommandBuffersUnique(
          vk::CommandBufferAllocateInfo{
            *scp.back(), // per thread pool
            vk::CommandBufferLevel::eSecondary,
            (uint32_t)window.numImageIndices() // a secondary command buffer per each swap image, access via *scb[i_th thread][j_th imageindex]
          }
        )
      )
    );
  }

  // begin rendering frames
  int frame = 0;

  // Loop waiting for the window to close.
  while (!glfwWindowShouldClose(glfwwindow)) {
    glfwPollEvents();

    // we generate the different fractions of the command buffer dynamically
    // on different threads and join them for final render with single call of executeCommands.
    window.draw(
      fw.device(), fw.graphicsQueue(),
      [&](vk::CommandBuffer cb, int imageIndex, vk::RenderPassBeginInfo &rpbi) {

        // shared state used by each kernel thread
        vk::CommandBufferInheritanceInfo inheritanceInfo;
        inheritanceInfo.setRenderPass( rpbi.renderPass );
        inheritanceInfo.setFramebuffer( rpbi.framebuffer );
        vk::CommandBufferBeginInfo commandBufferBeginInfo(vk::CommandBufferUsageFlagBits::eRenderPassContinue, &inheritanceInfo);

        // Multi-threaded command buffer generation aka multi-threaded rendering:
        //
        //     Have one command pool per thread.
        //     You populate different secondary-level (VK_COMMAND_BUFFER_LEVEL_SECONDARY) command buffers per thread.
        //     In your main thread you have a primary command buffer.
        //     After all threads are done building you call vkCmdExecuteCommands with your secondary-level command buffers.
        //     You submit the primary command buffer and get a fence back.
        //     A few frames down the line you check if the fence is triggered and if it is you free, or even better, re-use the command buffers.
        //     To re-use the command buffers you reset them. When some thread asks for a command buffer you give back one of the reset ones.
        //
        // For example, consider Nthreads=3 and N objects
        // 1234567890AB  N
        // 012           i=0; i<Nthreads; ++i
        // 0^^3  6  9    on Thread i=0: j=0;j<N;j+=Nthreads
        //  1^ 4  7  A   on Thread i=1: j=1;j<N;j+=Nthreads
        //   2  5  8  B  on Thread i=2: j=2;j<N;j+=Nthreads

        // build (multi-threaded) list of secondary command buffers to be executed later
        std::vector<vk::CommandBuffer> commandBuffers;
        { // threadRenderCode
          auto kernel = [&](const int i)->void{
            vk::CommandBuffer cmdBuffer = *scb[i][imageIndex];
            cmdBuffer.begin(commandBufferBeginInfo);
            cmdBuffer.bindPipeline(vk::PipelineBindPoint::eGraphics, *pipeline);
            cmdBuffer.bindVertexBuffers(0, buffer.buffer(), vk::DeviceSize(0));
            for (int j=i; j<N; j+=Nthreads) {
              // update p here
              PushConstant *p = &P[j];
              p->transform *= glm::rotate(glm::radians(1.0f*(1.0f-j/float(N))), glm::vec3(0, 0, 1));
              p->colour.r = (std::sin(frame * 0.01f) + 1.0f) / 2.0f;
              p->colour.g = (std::cos(frame * 0.01f) + 1.0f) / 2.0f;

              // Use pushConstants to set individual object's values.
              // vulkan guaranteed a pushConstant size of 128 bytes or less always possible.
              // This takes a copy of the push constant at the time
              // we create this command buffer.
              cmdBuffer.pushConstants(
                *pipelineLayout, vk::ShaderStageFlagBits::eAll, 0, sizeof(PushConstant), p
              );
              cmdBuffer.draw(vertices.size(), 1, 0, 0); // since secondary buffer, not drawn yet, just recorded for later
            };
            cmdBuffer.end();
          };

          // *** spawn separate rendering kernel threads to build separate command buffers in parallel ***
          for (int i=0; i<Nthreads; ++i) {
            v[i] = std::thread( kernel, i );
          }

          // wait for all of the kernel threads to finish
          for (int i=0; i<Nthreads; ++i) {
            v[i].join();
          }

          // accumulate secondary command buffers built by kernel threads
          for (int i=0; i<Nthreads; ++i) {
            commandBuffers.push_back( *scb[i][imageIndex] );
          }
        }

        // execute accumlated commandBuffers
        vk::CommandBufferBeginInfo bi{};
        cb.begin(bi);
        cb.beginRenderPass(rpbi, vk::SubpassContents::eSecondaryCommandBuffers);
        cb.executeCommands( commandBuffers );
        cb.endRenderPass();
        cb.end();
      }
    );

    // Very crude method to prevent your GPU from overheating.
    //std::this_thread::sleep_for(std::chrono::milliseconds(16));

    ++frame;
  }

  // Wait until all drawing is done and then kill the window.
  fw.device().waitIdle();
  glfwDestroyWindow(glfwwindow);
  glfwTerminate();

  // The Framework and Window objects will be destroyed here.

  return 0;
}


text:
layout: post
title:  "React Native with Elm"
date:   2017-05-05 11:44:00 -0400
categories:
label: ep-033
number: 33
tiny_description: Build a basic React Native app using Elm.
---

Because Elm compiles into Javascript, it's a candidate to be used with [React Native](https://facebook.github.io/react-native/) to build native iOS and Android applications.
Use [ohanhi/elm-native-ui](https://github.com/ohanhi/elm-native-ui) to handle the main application and view layer, and the rest of the Elm architecture to build runtime error-free mobile apps.

### Examples

**index.ios.js**

```js
const { AppRegistry } = require('react-native');
const Elm = require('./elm');
const component = Elm.Main.start();

AppRegistry.registerComponent('CardCounter', () => component);
```

**Main.elm**

```elm
import NativeUi as Ui exposing (Node)
import NativeUi.Style as Style exposing (defaultTransform)
import NativeUi.Elements as Elements exposing (..)
import NativeUi.Events exposing (..)
import NativeUi.Image as Image exposing (..)

main : Program Never Model Msg
main =
    Ui.program
        { init = ( model, Cmd.none )
        , view = view
        , update = update
        , subscriptions = \_ -> Sub.none
        }

```

#### Links

* [React Native - Getting Started](https://facebook.github.io/react-native/docs/getting-started.html)
* [Writing a React Native app in Elm](http://ohanhi.com/elm-native-ui.html)


text:
package com.google.testdata;

import static com.google.base.TestConstants.SQL_TESTDATA_BASE_PATH;
import static com.google.sql.SqlUtil.executeQueries;
import static com.google.sql.SqlUtil.getSql;
import static com.google.testdata.TestDataHelper.getRandomDbName;
import static com.google.testdata.TestDataHelper.getRandomTableName;
import static java.lang.String.format;
import static java.lang.System.lineSeparator;

import com.google.common.base.Joiner;
import com.google.testdata.pojo.TestDataUser;
import com.google.testdata.utils.PerformanceTestDataGeneratorQueryExecutor;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.concurrent.ForkJoinPool;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/** Helper class providing test data generation methods */
public final class PerformanceTestDataHelper {

  private static final Logger LOGGER = LoggerFactory.getLogger(PerformanceTestDataHelper.class);

  private PerformanceTestDataHelper() {}

  /**
   * @param connection DB connection parameter
   * @param tablesCount Count of tables to generate
   */
  public static void generateTables(Connection connection, int tablesCount) throws SQLException {
    final int USER_COUNT = 5;
    final int TABLES_PER_USER = tablesCount / USER_COUNT;
    final int SIZE = 2048 * TABLES_PER_USER;

    HashMap<TestDataUser, List<String>> performancePayload = new HashMap<>();
    List<String> preconditionQueries = new ArrayList<>();

    final String createUserSql = getSql(SQL_TESTDATA_BASE_PATH + "users_data.sql");
    final String createDbSql = getSql(SQL_TESTDATA_BASE_PATH + "performance_data_1.sql");
    final String grantCreateTableSql = getSql(SQL_TESTDATA_BASE_PATH + "performance_data_2.sql");
    final String createTableSql = getSql(SQL_TESTDATA_BASE_PATH + "columns_data_2.sql");

    for (int i = 0; i < USER_COUNT; i++) {
      List<String> queries = new ArrayList<>();
      TestDataUser userData = new TestDataUser();
      String dbName = getRandomDbName();

      String createUser = format(createUserSql, userData.getUsername(), userData.getPassword());
      String createDatabase = format(createDbSql, dbName, SIZE, SIZE, SIZE);
      String grantCreateTable = format(grantCreateTableSql, dbName, userData.getUsername());
      preconditionQueries.addAll(Arrays.asList(createUser, createDatabase, grantCreateTable));

      for (int j = 0; j < TABLES_PER_USER; j++) {
        String tableName = getRandomTableName();
        String createTable = format(createTableSql, dbName, tableName);
        queries.add(createTable);
      }
      performancePayload.put(userData, queries);
    }

    executeQueries(connection, preconditionQueries);
    LOGGER.info(
        format(
            "Performance test precondition queries %n%s",
            Joiner.on(lineSeparator()).join(preconditionQueries)));

    PerformanceTestDataGeneratorQueryExecutor performanceTasks =
        new PerformanceTestDataGeneratorQueryExecutor(performancePayload, 0, USER_COUNT);
    new ForkJoinPool().invoke(performanceTasks);
  }
}


text:
Client side Scaffolding is concerned with generating a starter template for the application as a whole, rather than [generating code to access a database](https://en.wikipedia.org/wiki/Scaffold_%28programming%29).

* [Slush](http://slushjs.github.io/#/)
* [Yeoman](http://yeoman.io/)


text:
import Civ5Save from '../Civ5Save';

const path = require('path');

const TEST_SAVEGAME_V10017 = path.join(__dirname, 'resources', '1.0.0.17.Civ5Save');
const TEST_SAVEGAME_V101135 = path.join(__dirname, 'resources', '1.0.1.135.Civ5Save');
const TEST_SAVEGAME_V101221 = path.join(__dirname, 'resources', '1.0.1.221.Civ5Save');
const TEST_SAVEGAME_V10213 = path.join(__dirname, 'resources', '1.0.2.13.Civ5Save');
const TEST_SAVEGAME_V103279 = path.join(__dirname, 'resources', '1.0.3.279.Civ5Save');
const TEST_SAVEGAME_BROKEN = path.join(__dirname, 'resources', 'broken.Civ5Save');

const NEW_ALWAYS_PEACE = true;
const NEW_ALWAYS_WAR = true;
const NEW_COMPLETE_KILLS = false;
const NEW_CULTURAL_VICTORY = false;
const NEW_DIPLOMATIC_VICTORY = true;
const NEW_DOMINATION_VICTORY = true;
const NEW_LOCK_MODS = true;
const NEW_MAX_TURNS = 123;
const NEW_NEW_RANDOM_SEED = true;
const NEW_NO_BARBARIANS = false;
const NEW_NO_CHANGING_WAR_OR_PEACE = true;
const NEW_NO_CITY_RAZING = false;
const NEW_NO_CULTURE_OVERVIEW_UI = true;
const NEW_NO_ESPIONAGE = false;
const NEW_NO_HAPPINESS = true;
const NEW_NO_POLICIES = true;
const NEW_NO_RELIGION = false;
const NEW_NO_SCIENCE = true;
const NEW_NO_WORLD_CONGRESS = true;
const NEW_ONE_CITY_CHALLENGE = false;
const NEW_PITBOSS = false;
const NEW_POLICY_SAVING = false;
const NEW_PRIVATE_GAME = false;
const NEW_PROMOTION_SAVING = false;
const NEW_RAGING_BARBARIANS = false;
const NEW_RANDOM_PERSONALITIES = false;
const NEW_SCIENCE_VICTORY = false;
const NEW_TIME_VICTORY = true;
const NEW_TURN_TIMER_ENABLED = false;
const NEW_TURN_TIMER_VALUE = 321;
const NEW_TURN_MODE = Civ5Save.TURN_MODES.SIMULTANEOUS;

let savegame10017;
let savegame101135;
let savegame101221;
let savegame10213;
let savegame103279;

function getFileBlob(url) {
  return new Promise(function (resolve, reject) {
    let xhr = new XMLHttpRequest();
    xhr.open('GET', url);
    xhr.responseType = 'blob';
    xhr.addEventListener('load', function() {
      resolve(xhr.response);
    });
    xhr.addEventListener('error', function() {
      reject(xhr.statusText);
    });
    xhr.send();
  });
}

test('Create new Civ5Save instances from file', async () => {
  let fileBlob = await getFileBlob(TEST_SAVEGAME_V10017);
  savegame10017 = await Civ5Save.fromFile(fileBlob);

  fileBlob = await getFileBlob(TEST_SAVEGAME_V101135);
  savegame101135 = await Civ5Save.fromFile(fileBlob);

  fileBlob = await getFileBlob(TEST_SAVEGAME_V101221);
  savegame101221 = await Civ5Save.fromFile(fileBlob);

  fileBlob = await getFileBlob(TEST_SAVEGAME_V10213);
  savegame10213 = await Civ5Save.fromFile(fileBlob);

  fileBlob = await getFileBlob(TEST_SAVEGAME_V103279);
  savegame103279 = await Civ5Save.fromFile(fileBlob);
}, 20000);

test('Get game build', () => {
  expect(savegame10017.gameBuild).toBe('201080');
  expect(savegame101135.gameBuild).toBe('210752');
  expect(savegame101221.gameBuild).toBe('218015');
  expect(savegame10213.gameBuild).toBe('341540');
  expect(savegame103279.gameBuild).toBe('403694');
});

test('Get game version', () => {
  expect(savegame10017.gameVersion).not.toBeDefined();
  expect(savegame101135.gameVersion).not.toBeDefined();
  expect(savegame101221.gameVersion).not.toBeDefined();
  expect(savegame10213.gameVersion).toBe('1.0.2.13 (341540)');
  expect(savegame103279.gameVersion).toBe('1.0.3.279(130961)');
});

test('Get current turn', () => {
  expect(savegame10017.currentTurn).toBe(19);
  expect(savegame101135.currentTurn).toBe(176);
  expect(savegame101221.currentTurn).toBe(52);
  expect(savegame10213.currentTurn).toBe(12);
  expect(savegame103279.currentTurn).toBe(264);
});

test('Get game mode', () => {
  expect(savegame10017.gameMode).not.toBeDefined();
  expect(savegame101135.gameMode).not.toBeDefined();
  expect(savegame101221.gameMode).not.toBeDefined();
  expect(savegame10213.gameMode).toBe(Civ5Save.GAME_MODES.SINGLE);
  expect(savegame103279.gameMode).toBe(Civ5Save.GAME_MODES.MULTI);
});

test('Get difficulty', () => {
  expect(savegame10017.difficulty).toBe('Chieftain');
  expect(savegame101135.difficulty).toBe('Warlord');
  expect(savegame101221.difficulty).toBe('Prince');
  expect(savegame10213.difficulty).toBe('Immortal');
  expect(savegame103279.difficulty).toBe('Settler');
});

test('Get starting era', () => {
  expect(savegame10017.startingEra).toBe('Ancient');
  expect(savegame101135.startingEra).toBe('Ancient');
  expect(savegame101221.startingEra).toBe('Medieval');
  expect(savegame10213.startingEra).toBe('Ancient');
  expect(savegame103279.startingEra).toBe('Future');
});

test('Get current era', () => {
  expect(savegame10017.currentEra).toBe('Ancient');
  expect(savegame101135.currentEra).toBe('Ancient');
  expect(savegame101221.currentEra).toBe('Renaissance');
  expect(savegame10213.currentEra).toBe('Ancient');
  expect(savegame103279.currentEra).toBe('Future');
});

test('Get game pace', () => {
  expect(savegame10017.gamePace).toBe('Standard');
  expect(savegame101135.gamePace).toBe('Marathon');
  expect(savegame101221.gamePace).toBe('Quick');
  expect(savegame10213.gamePace).toBe('Standard');
  expect(savegame103279.gamePace).toBe('Quick');
});

test('Get map size', () => {
  expect(savegame10017.mapSize).toBe('Small');
  expect(savegame101135.mapSize).toBe('Huge');
  expect(savegame101221.mapSize).toBe('Standard');
  expect(savegame10213.mapSize).toBe('Standard');
  expect(savegame103279.mapSize).toBe('Duel');
});

test('Get map file', () => {
  expect(savegame10017.mapFile).toBe('Continents');
  expect(savegame101135.mapFile).toBe('Pangaea');
  expect(savegame101221.mapFile).toBe('NewWorld Scenario MapScript');
  expect(savegame10213.mapFile).toBe('Pangaea');
  expect(savegame103279.mapFile).toBe('Earth Duel');
});

test('Get enabled DLC', () => {
  expect(savegame10017.enabledDLC).toEqual([]);
  expect(savegame101135.enabledDLC).toEqual([
    'Babylon',
    'Upgrade 1',
    'Mongolia'
  ]);
  expect(savegame101221.enabledDLC).toEqual([
    'Spain and Inca',
    'Polynesia',
    'Babylon',
    'Upgrade 1',
    'Mongolia'
  ]);
  expect(savegame10213.enabledDLC).toEqual([
    'Mongolia',
    'Spain and Inca',
    'Polynesia',
    'Denmark',
    'Korea',
    'Ancient Wonders',
    'Babylon',
    'Expansion - Gods and Kings',
    'Upgrade 1'
  ]);
  expect(savegame103279.enabledDLC).toEqual([
    'Mongolia',
    'Spain and Inca',
    'Polynesia',
    'Denmark',
    'Korea',
    'Ancient Wonders',
    'Civilization 5 Complete',
    'Babylon',
    'DLC_SP_Maps',
    'DLC_SP_Maps_2',
    'DLC_SP_Maps_3',
    'Expansion - Gods and Kings',
    'Expansion - Brave New World',
    'Upgrade 1'
  ]);
});

test('Get enabled Mods', () => {
  expect(savegame10017.enabledMods).toEqual([]);
  expect(savegame101135.enabledMods).toEqual([]);
  expect(savegame101221.enabledMods).toEqual([
    'Conquest of the New World',
  ]);
  expect(savegame10213.enabledMods).toEqual([]);
  expect(savegame103279.enabledMods).toEqual([]);
});

test('Get players', () => {
  expect(savegame10017.players).toEqual([
    {
      civilization: 'Persia',
      status: Civ5Save.PLAYER_STATUSES.HUMAN
    },
    {
      civilization: undefined,
      status: Civ5Save.PLAYER_STATUSES.AI
    },
    {
      civilization: undefined,
      status: Civ5Save.PLAYER_STATUSES.AI
    },
    {
      civilization: undefined,
      status: Civ5Save.PLAYER_STATUSES.AI
    },
    {
      civilization: undefined,
      status: Civ5Save.PLAYER_STATUSES.AI
    },
    {
      civilization: undefined,
      status: Civ5Save.PLAYER_STATUSES.AI
    },
  ]);
  expect(savegame101135.players).toEqual([
    {
      civilization: 'Arabia',
      status: Civ5Save.PLAYER_STATUSES.HUMAN
    },
    {
      civilization: undefined,
      status: Civ5Save.PLAYER_STATUSES.AI
    },
    {
      civilization: undefined,
      status: Civ5Save.PLAYER_STATUSES.AI
    },
    {
      civilization: undefined,
      status: Civ5Save.PLAYER_STATUSES.AI
    },
    {
      civilization: undefined,
      status: Civ5Save.PLAYER_STATUSES.AI
    },
    {
      civilization: undefined,
      status: Civ5Save.PLAYER_STATUSES.AI
    },
    {
      civilization: undefined,
      status: Civ5Save.PLAYER_STATUSES.AI
    },
    {
      civilization: undefined,
      status: Civ5Save.PLAYER_STATUSES.AI
    },
    {
      civilization: undefined,
      status: Civ5Save.PLAYER_STATUSES.AI
    },
    {
      civilization: undefined,
      status: Civ5Save.PLAYER_STATUSES.AI
    },
    {
      civilization: undefined,
      status: Civ5Save.PLAYER_STATUSES.DEAD
    },
    {
      civilization: undefined,
      status: Civ5Save.PLAYER_STATUSES.DEAD
    },
  ]);
  expect(savegame101221.players).toEqual([
    {
      civilization: 'France',
      status: Civ5Save.PLAYER_STATUSES.HUMAN
    },
    {
      civilization: undefined,
      status: Civ5Save.PLAYER_STATUSES.AI
    },
    {
      civilization: undefined,
      status: Civ5Save.PLAYER_STATUSES.AI
    },
    {
      civilization: undefined,
      status: Civ5Save.PLAYER_STATUSES.AI
    },
    {
      civilization: undefined,
      status: Civ5Save.PLAYER_STATUSES.AI
    },
    {
      civilization: undefined,
      status: Civ5Save.PLAYER_STATUSES.AI
    },
    {
      civilization: undefined,
      status: Civ5Save.PLAYER_STATUSES.DEAD
    },
    {
      civilization: undefined,
      status: Civ5Save.PLAYER_STATUSES.DEAD
    },
  ]);
  expect(savegame10213.players).toEqual([
    {
      civilization: 'Spain',
      status: Civ5Save.PLAYER_STATUSES.HUMAN
    },
    {
      civilization: 'Ottoman',
      status: Civ5Save.PLAYER_STATUSES.AI
    },
    {
      civilization: 'Greece',
      status: Civ5Save.PLAYER_STATUSES.AI
    },
    {
      civilization: 'Egypt',
      status: Civ5Save.PLAYER_STATUSES.AI
    },
    {
      civilization: 'Byzantium',
      status: Civ5Save.PLAYER_STATUSES.AI
    },
    {
      civilization: 'Austria',
      status: Civ5Save.PLAYER_STATUSES.AI
    },
    {
      civilization: 'Songhai',
      status: Civ5Save.PLAYER_STATUSES.AI
    },
    {
      civilization: 'Ethiopia',
      status: Civ5Save.PLAYER_STATUSES.AI
    },
  ]);
  expect(savegame103279.players).toEqual([
    {
      civilization: 'Denmark',
      status: Civ5Save.PLAYER_STATUSES.HUMAN
    },
    {
      civilization: 'Austria',
      status: Civ5Save.PLAYER_STATUSES.AI
    },
  ]);
});

test('Get always peace', () => {
  expect(savegame10017.alwaysPeace).toBe(false);
  expect(savegame101135.alwaysPeace).toBe(false);
  expect(savegame101221.alwaysPeace).toBe(false);
  expect(savegame10213.alwaysPeace).toBe(false);
  expect(savegame103279.alwaysPeace).toBe(false);
});

test('Set always peace', async () => {
  savegame10017.alwaysPeace = NEW_ALWAYS_PEACE;
  savegame101135.alwaysPeace = NEW_ALWAYS_PEACE;
  savegame101221.alwaysPeace = NEW_ALWAYS_PEACE;
  savegame10213.alwaysPeace = NEW_ALWAYS_PEACE;
  savegame103279.alwaysPeace = NEW_ALWAYS_PEACE;
  expect(savegame10017.alwaysPeace).toBe(NEW_ALWAYS_PEACE);
  expect(savegame101135.alwaysPeace).toBe(NEW_ALWAYS_PEACE);
  expect(savegame101221.alwaysPeace).toBe(NEW_ALWAYS_PEACE);
  expect(savegame10213.alwaysPeace).toBe(NEW_ALWAYS_PEACE);
  expect(savegame103279.alwaysPeace).toBe(NEW_ALWAYS_PEACE);
});

test('Get always war', () => {
  expect(savegame10017.alwaysWar).toBe(false);
  expect(savegame101135.alwaysWar).toBe(false);
  expect(savegame101221.alwaysWar).toBe(false);
  expect(savegame10213.alwaysWar).toBe(false);
  expect(savegame103279.alwaysWar).toBe(false);
});

test('Set always war', async () => {
  savegame10017.alwaysWar = NEW_ALWAYS_WAR;
  savegame101135.alwaysWar = NEW_ALWAYS_WAR;
  savegame101221.alwaysWar = NEW_ALWAYS_WAR;
  savegame10213.alwaysWar = NEW_ALWAYS_WAR;
  savegame103279.alwaysWar = NEW_ALWAYS_WAR;
  expect(savegame10017.alwaysWar).toBe(NEW_ALWAYS_WAR);
  expect(savegame101135.alwaysWar).toBe(NEW_ALWAYS_WAR);
  expect(savegame101221.alwaysWar).toBe(NEW_ALWAYS_WAR);
  expect(savegame10213.alwaysWar).toBe(NEW_ALWAYS_WAR);
  expect(savegame103279.alwaysWar).toBe(NEW_ALWAYS_WAR);
});

test('Get complete kills', () => {
  expect(savegame10017.completeKills).toBe(false);
  expect(savegame101135.completeKills).toBe(false);
  expect(savegame101221.completeKills).toBe(false);
  expect(savegame10213.completeKills).toBe(false);
  expect(savegame103279.completeKills).toBe(true);
});

test('Set complete kills', async () => {
  savegame10017.completeKills = NEW_COMPLETE_KILLS;
  savegame101135.completeKills = NEW_COMPLETE_KILLS;
  savegame101221.completeKills = NEW_COMPLETE_KILLS;
  savegame10213.completeKills = NEW_COMPLETE_KILLS;
  savegame103279.completeKills = NEW_COMPLETE_KILLS;
  expect(savegame10017.completeKills).toBe(NEW_COMPLETE_KILLS);
  expect(savegame101135.completeKills).toBe(NEW_COMPLETE_KILLS);
  expect(savegame101221.completeKills).toBe(NEW_COMPLETE_KILLS);
  expect(savegame10213.completeKills).toBe(NEW_COMPLETE_KILLS);
  expect(savegame103279.completeKills).toBe(NEW_COMPLETE_KILLS);
});

test('Get lock mods', () => {
  expect(savegame10017.lockMods).toBe(false);
  expect(savegame101135.lockMods).toBe(false);
  expect(savegame101221.lockMods).toBe(false);
  expect(savegame10213.lockMods).toBe(false);
  expect(savegame103279.lockMods).toBe(false);
});

test('Set lock mods', async () => {
  savegame10017.lockMods = NEW_LOCK_MODS;
  savegame101135.lockMods = NEW_LOCK_MODS;
  savegame101221.lockMods = NEW_LOCK_MODS;
  savegame10213.lockMods = NEW_LOCK_MODS;
  savegame103279.lockMods = NEW_LOCK_MODS;
  expect(savegame10017.lockMods).toBe(NEW_LOCK_MODS);
  expect(savegame101135.lockMods).toBe(NEW_LOCK_MODS);
  expect(savegame101221.lockMods).toBe(NEW_LOCK_MODS);
  expect(savegame10213.lockMods).toBe(NEW_LOCK_MODS);
  expect(savegame103279.lockMods).toBe(NEW_LOCK_MODS);
});

test('Get new random seed', () => {
  expect(savegame10017.newRandomSeed).toBe(false);
  expect(savegame101135.newRandomSeed).toBe(false);
  expect(savegame101221.newRandomSeed).toBe(false);
  expect(savegame10213.newRandomSeed).toBe(false);
  expect(savegame103279.newRandomSeed).toBe(false);
});

test('Set new random seed', async () => {
  savegame10017.newRandomSeed = NEW_NEW_RANDOM_SEED;
  savegame101135.newRandomSeed = NEW_NEW_RANDOM_SEED;
  savegame101221.newRandomSeed = NEW_NEW_RANDOM_SEED;
  savegame10213.newRandomSeed = NEW_NEW_RANDOM_SEED;
  savegame103279.newRandomSeed = NEW_NEW_RANDOM_SEED;
  expect(savegame10017.newRandomSeed).toBe(NEW_NEW_RANDOM_SEED);
  expect(savegame101135.newRandomSeed).toBe(NEW_NEW_RANDOM_SEED);
  expect(savegame101221.newRandomSeed).toBe(NEW_NEW_RANDOM_SEED);
  expect(savegame10213.newRandomSeed).toBe(NEW_NEW_RANDOM_SEED);
  expect(savegame103279.newRandomSeed).toBe(NEW_NEW_RANDOM_SEED);
});

test('Get no barbarians', () => {
  expect(savegame10017.noBarbarians).toBe(false);
  expect(savegame101135.noBarbarians).toBe(false);
  expect(savegame101221.noBarbarians).toBe(false);
  expect(savegame10213.noBarbarians).toBe(false);
  expect(savegame103279.noBarbarians).toBe(true);
});

test('Set no barbarians', async () => {
  savegame10017.noBarbarians = NEW_NO_BARBARIANS;
  savegame101135.noBarbarians = NEW_NO_BARBARIANS;
  savegame101221.noBarbarians = NEW_NO_BARBARIANS;
  savegame10213.noBarbarians = NEW_NO_BARBARIANS;
  savegame103279.noBarbarians = NEW_NO_BARBARIANS;
  expect(savegame10017.noBarbarians).toBe(NEW_NO_BARBARIANS);
  expect(savegame101135.noBarbarians).toBe(NEW_NO_BARBARIANS);
  expect(savegame101221.noBarbarians).toBe(NEW_NO_BARBARIANS);
  expect(savegame10213.noBarbarians).toBe(NEW_NO_BARBARIANS);
  expect(savegame103279.noBarbarians).toBe(NEW_NO_BARBARIANS);
});

test('Get no changing war or peace', () => {
  expect(savegame10017.noChangingWarPeace).toBe(false);
  expect(savegame101135.noChangingWarPeace).toBe(false);
  expect(savegame101221.noChangingWarPeace).toBe(false);
  expect(savegame10213.noChangingWarPeace).toBe(false);
  expect(savegame103279.noChangingWarPeace).toBe(false);
});

test('Set no changing war or peace', async () => {
  savegame10017.noChangingWarPeace = NEW_NO_CHANGING_WAR_OR_PEACE;
  savegame101135.noChangingWarPeace = NEW_NO_CHANGING_WAR_OR_PEACE;
  savegame101221.noChangingWarPeace = NEW_NO_CHANGING_WAR_OR_PEACE;
  savegame10213.noChangingWarPeace = NEW_NO_CHANGING_WAR_OR_PEACE;
  savegame103279.noChangingWarPeace = NEW_NO_CHANGING_WAR_OR_PEACE;
  expect(savegame10017.noChangingWarPeace).toBe(NEW_NO_CHANGING_WAR_OR_PEACE);
  expect(savegame101135.noChangingWarPeace).toBe(NEW_NO_CHANGING_WAR_OR_PEACE);
  expect(savegame101221.noChangingWarPeace).toBe(NEW_NO_CHANGING_WAR_OR_PEACE);
  expect(savegame10213.noChangingWarPeace).toBe(NEW_NO_CHANGING_WAR_OR_PEACE);
  expect(savegame103279.noChangingWarPeace).toBe(NEW_NO_CHANGING_WAR_OR_PEACE);
});

test('Get no city razing', () => {
  expect(savegame10017.noCityRazing).toBe(false);
  expect(savegame101135.noCityRazing).toBe(false);
  expect(savegame101221.noCityRazing).toBe(false);
  expect(savegame10213.noCityRazing).toBe(false);
  expect(savegame103279.noCityRazing).toBe(true);
});

test('Set no city razing', async () => {
  savegame10017.noCityRazing = NEW_NO_CITY_RAZING;
  savegame101135.noCityRazing = NEW_NO_CITY_RAZING;
  savegame101221.noCityRazing = NEW_NO_CITY_RAZING;
  savegame10213.noCityRazing = NEW_NO_CITY_RAZING;
  savegame103279.noCityRazing = NEW_NO_CITY_RAZING;
  expect(savegame10017.noCityRazing).toBe(NEW_NO_CITY_RAZING);
  expect(savegame101135.noCityRazing).toBe(NEW_NO_CITY_RAZING);
  expect(savegame101221.noCityRazing).toBe(NEW_NO_CITY_RAZING);
  expect(savegame10213.noCityRazing).toBe(NEW_NO_CITY_RAZING);
  expect(savegame103279.noCityRazing).toBe(NEW_NO_CITY_RAZING);
});

test('Get no culture overview UI', () => {
  expect(savegame10017.noCultureOverviewUI).toBe(false);
  expect(savegame101135.noCultureOverviewUI).toBe(false);
  expect(savegame101221.noCultureOverviewUI).toBe(false);
  expect(savegame10213.noCultureOverviewUI).toBe(false);
  expect(savegame103279.noCultureOverviewUI).toBe(false);
});

test('Set no culture overview UI', async () => {
  savegame10017.noCultureOverviewUI = NEW_NO_CULTURE_OVERVIEW_UI;
  savegame101135.noCultureOverviewUI = NEW_NO_CULTURE_OVERVIEW_UI;
  savegame101221.noCultureOverviewUI = NEW_NO_CULTURE_OVERVIEW_UI;
  savegame10213.noCultureOverviewUI = NEW_NO_CULTURE_OVERVIEW_UI;
  savegame103279.noCultureOverviewUI = NEW_NO_CULTURE_OVERVIEW_UI;
  expect(savegame10017.noCultureOverviewUI).toBe(NEW_NO_CULTURE_OVERVIEW_UI);
  expect(savegame101135.noCultureOverviewUI).toBe(NEW_NO_CULTURE_OVERVIEW_UI);
  expect(savegame101221.noCultureOverviewUI).toBe(NEW_NO_CULTURE_OVERVIEW_UI);
  expect(savegame10213.noCultureOverviewUI).toBe(NEW_NO_CULTURE_OVERVIEW_UI);
  expect(savegame103279.noCultureOverviewUI).toBe(NEW_NO_CULTURE_OVERVIEW_UI);
});

test('Get no espionage', () => {
  expect(savegame10017.noEspionage).toBe(false);
  expect(savegame101135.noEspionage).toBe(false);
  expect(savegame101221.noEspionage).toBe(false);
  expect(savegame10213.noEspionage).toBe(false);
  expect(savegame103279.noEspionage).toBe(true);
});

test('Set no espionage', async () => {
  savegame10017.noEspionage = NEW_NO_ESPIONAGE;
  savegame101135.noEspionage = NEW_NO_ESPIONAGE;
  savegame101221.noEspionage = NEW_NO_ESPIONAGE;
  savegame10213.noEspionage = NEW_NO_ESPIONAGE;
  savegame103279.noEspionage = NEW_NO_ESPIONAGE;
  expect(savegame10017.noEspionage).toBe(NEW_NO_ESPIONAGE);
  expect(savegame101135.noEspionage).toBe(NEW_NO_ESPIONAGE);
  expect(savegame101221.noEspionage).toBe(NEW_NO_ESPIONAGE);
  expect(savegame10213.noEspionage).toBe(NEW_NO_ESPIONAGE);
  expect(savegame103279.noEspionage).toBe(NEW_NO_ESPIONAGE);
});

test('Get no happiness', () => {
  expect(savegame10017.noHappiness).toBe(false);
  expect(savegame101135.noHappiness).toBe(false);
  expect(savegame101221.noHappiness).toBe(false);
  expect(savegame10213.noHappiness).toBe(false);
  expect(savegame103279.noHappiness).toBe(false);
});

test('Set no happiness', async () => {
  savegame10017.noHappiness = NEW_NO_HAPPINESS;
  savegame101135.noHappiness = NEW_NO_HAPPINESS;
  savegame101221.noHappiness = NEW_NO_HAPPINESS;
  savegame10213.noHappiness = NEW_NO_HAPPINESS;
  savegame103279.noHappiness = NEW_NO_HAPPINESS;
  expect(savegame10017.noHappiness).toBe(NEW_NO_HAPPINESS);
  expect(savegame101135.noHappiness).toBe(NEW_NO_HAPPINESS);
  expect(savegame101221.noHappiness).toBe(NEW_NO_HAPPINESS);
  expect(savegame10213.noHappiness).toBe(NEW_NO_HAPPINESS);
  expect(savegame103279.noHappiness).toBe(NEW_NO_HAPPINESS);
});

test('Get no policies', () => {
  expect(savegame10017.noPolicies).toBe(false);
  expect(savegame101135.noPolicies).toBe(false);
  expect(savegame101221.noPolicies).toBe(false);
  expect(savegame10213.noPolicies).toBe(false);
  expect(savegame103279.noPolicies).toBe(false);
});

test('Set no policies', async () => {
  savegame10017.noPolicies = NEW_NO_POLICIES;
  savegame101135.noPolicies = NEW_NO_POLICIES;
  savegame101221.noPolicies = NEW_NO_POLICIES;
  savegame10213.noPolicies = NEW_NO_POLICIES;
  savegame103279.noPolicies = NEW_NO_POLICIES;
  expect(savegame10017.noPolicies).toBe(NEW_NO_POLICIES);
  expect(savegame101135.noPolicies).toBe(NEW_NO_POLICIES);
  expect(savegame101221.noPolicies).toBe(NEW_NO_POLICIES);
  expect(savegame10213.noPolicies).toBe(NEW_NO_POLICIES);
  expect(savegame103279.noPolicies).toBe(NEW_NO_POLICIES);
});

test('Get no religion', () => {
  expect(savegame10017.noReligion).toBe(false);
  expect(savegame101135.noReligion).toBe(false);
  expect(savegame101221.noReligion).toBe(false);
  expect(savegame10213.noReligion).toBe(false);
  expect(savegame103279.noReligion).toBe(true);
});

test('Set no religion', async () => {
  savegame10017.noReligion = NEW_NO_RELIGION;
  savegame101135.noReligion = NEW_NO_RELIGION;
  savegame101221.noReligion = NEW_NO_RELIGION;
  savegame10213.noReligion = NEW_NO_RELIGION;
  savegame103279.noReligion = NEW_NO_RELIGION;
  expect(savegame10017.noReligion).toBe(NEW_NO_RELIGION);
  expect(savegame101135.noReligion).toBe(NEW_NO_RELIGION);
  expect(savegame101221.noReligion).toBe(NEW_NO_RELIGION);
  expect(savegame10213.noReligion).toBe(NEW_NO_RELIGION);
  expect(savegame103279.noReligion).toBe(NEW_NO_RELIGION);
});

test('Get no science', () => {
  expect(savegame10017.noScience).toBe(false);
  expect(savegame101135.noScience).toBe(false);
  expect(savegame101221.noScience).toBe(false);
  expect(savegame10213.noScience).toBe(false);
  expect(savegame103279.noScience).toBe(false);
});

test('Set no science', async () => {
  savegame10017.noScience = NEW_NO_SCIENCE;
  savegame101135.noScience = NEW_NO_SCIENCE;
  savegame101221.noScience = NEW_NO_SCIENCE;
  savegame10213.noScience = NEW_NO_SCIENCE;
  savegame103279.noScience = NEW_NO_SCIENCE;
  expect(savegame10017.noScience).toBe(NEW_NO_SCIENCE);
  expect(savegame101135.noScience).toBe(NEW_NO_SCIENCE);
  expect(savegame101221.noScience).toBe(NEW_NO_SCIENCE);
  expect(savegame10213.noScience).toBe(NEW_NO_SCIENCE);
  expect(savegame103279.noScience).toBe(NEW_NO_SCIENCE);
});

test('Get no world congress', () => {
  expect(savegame10017.noWorldCongress).toBe(false);
  expect(savegame101135.noWorldCongress).toBe(false);
  expect(savegame101221.noWorldCongress).toBe(false);
  expect(savegame10213.noWorldCongress).toBe(false);
  expect(savegame103279.noWorldCongress).toBe(false);
});

test('Set no world congress', async () => {
  savegame10017.noWorldCongress = NEW_NO_WORLD_CONGRESS;
  savegame101135.noWorldCongress = NEW_NO_WORLD_CONGRESS;
  savegame101221.noWorldCongress = NEW_NO_WORLD_CONGRESS;
  savegame10213.noWorldCongress = NEW_NO_WORLD_CONGRESS;
  savegame103279.noWorldCongress = NEW_NO_WORLD_CONGRESS;
  expect(savegame10017.noWorldCongress).toBe(NEW_NO_WORLD_CONGRESS);
  expect(savegame101135.noWorldCongress).toBe(NEW_NO_WORLD_CONGRESS);
  expect(savegame101221.noWorldCongress).toBe(NEW_NO_WORLD_CONGRESS);
  expect(savegame10213.noWorldCongress).toBe(NEW_NO_WORLD_CONGRESS);
  expect(savegame103279.noWorldCongress).toBe(NEW_NO_WORLD_CONGRESS);
});

test('Get one city challenge', () => {
  expect(savegame10017.oneCityChallenge).toBe(false);
  expect(savegame101135.oneCityChallenge).toBe(false);
  expect(savegame101221.oneCityChallenge).toBe(false);
  expect(savegame10213.oneCityChallenge).toBe(false);
  expect(savegame103279.oneCityChallenge).toBe(true);
});

test('Set one city challenge', async () => {
  savegame10017.oneCityChallenge = NEW_ONE_CITY_CHALLENGE;
  savegame101135.oneCityChallenge = NEW_ONE_CITY_CHALLENGE;
  savegame101221.oneCityChallenge = NEW_ONE_CITY_CHALLENGE;
  savegame10213.oneCityChallenge = NEW_ONE_CITY_CHALLENGE;
  savegame103279.oneCityChallenge = NEW_ONE_CITY_CHALLENGE;
  expect(savegame10017.oneCityChallenge).toBe(NEW_ONE_CITY_CHALLENGE);
  expect(savegame101135.oneCityChallenge).toBe(NEW_ONE_CITY_CHALLENGE);
  expect(savegame101221.oneCityChallenge).toBe(NEW_ONE_CITY_CHALLENGE);
  expect(savegame10213.oneCityChallenge).toBe(NEW_ONE_CITY_CHALLENGE);
  expect(savegame103279.oneCityChallenge).toBe(NEW_ONE_CITY_CHALLENGE);
});

test('Get pitboss', () => {
  expect(savegame10017.pitboss).toBe(false);
  expect(savegame101135.pitboss).toBe(false);
  expect(savegame101221.pitboss).toBe(false);
  expect(savegame10213.pitboss).toBe(false);
  expect(savegame103279.pitboss).toBe(true);
});

test('Set pitboss', async () => {
  savegame10017.pitboss = NEW_PITBOSS;
  savegame101135.pitboss = NEW_PITBOSS;
  savegame101221.pitboss = NEW_PITBOSS;
  savegame10213.pitboss = NEW_PITBOSS;
  savegame103279.pitboss = NEW_PITBOSS;
  expect(savegame10017.pitboss).toBe(NEW_PITBOSS);
  expect(savegame101135.pitboss).toBe(NEW_PITBOSS);
  expect(savegame101221.pitboss).toBe(NEW_PITBOSS);
  expect(savegame10213.pitboss).toBe(NEW_PITBOSS);
  expect(savegame103279.pitboss).toBe(NEW_PITBOSS);
});

test('Get policy saving', () => {
  expect(savegame10017.policySaving).toBe(false);
  expect(savegame101135.policySaving).toBe(false);
  expect(savegame101221.policySaving).toBe(false);
  expect(savegame10213.policySaving).toBe(false);
  expect(savegame103279.policySaving).toBe(true);
});

test('Set policy saving', async () => {
  savegame10017.policySaving = NEW_POLICY_SAVING;
  savegame101135.policySaving = NEW_POLICY_SAVING;
  savegame101221.policySaving = NEW_POLICY_SAVING;
  savegame10213.policySaving = NEW_POLICY_SAVING;
  savegame103279.policySaving = NEW_POLICY_SAVING;
  expect(savegame10017.policySaving).toBe(NEW_POLICY_SAVING);
  expect(savegame101135.policySaving).toBe(NEW_POLICY_SAVING);
  expect(savegame101221.policySaving).toBe(NEW_POLICY_SAVING);
  expect(savegame10213.policySaving).toBe(NEW_POLICY_SAVING);
  expect(savegame103279.policySaving).toBe(NEW_POLICY_SAVING);
});

test('Get promotion saving', () => {
  expect(savegame10017.promotionSaving).toBe(false);
  expect(savegame101135.promotionSaving).toBe(false);
  expect(savegame101221.promotionSaving).toBe(false);
  expect(savegame10213.promotionSaving).toBe(false);
  expect(savegame103279.promotionSaving).toBe(true);
});

test('Set promotion saving', async () => {
  savegame10017.promotionSaving = NEW_PROMOTION_SAVING;
  savegame101135.promotionSaving = NEW_PROMOTION_SAVING;
  savegame101221.promotionSaving = NEW_PROMOTION_SAVING;
  savegame10213.promotionSaving = NEW_PROMOTION_SAVING;
  savegame103279.promotionSaving = NEW_PROMOTION_SAVING;
  expect(savegame10017.promotionSaving).toBe(NEW_PROMOTION_SAVING);
  expect(savegame101135.promotionSaving).toBe(NEW_PROMOTION_SAVING);
  expect(savegame101221.promotionSaving).toBe(NEW_PROMOTION_SAVING);
  expect(savegame10213.promotionSaving).toBe(NEW_PROMOTION_SAVING);
  expect(savegame103279.promotionSaving).toBe(NEW_PROMOTION_SAVING);
});

test('Get raging barbarians', () => {
  expect(savegame10017.ragingBarbarians).toBe(false);
  expect(savegame101135.ragingBarbarians).toBe(false);
  expect(savegame101221.ragingBarbarians).toBe(false);
  expect(savegame10213.ragingBarbarians).toBe(false);
  expect(savegame103279.ragingBarbarians).toBe(true);
});

test('Set raging barbarians', async () => {
  savegame10017.ragingBarbarians = NEW_RAGING_BARBARIANS;
  savegame101135.ragingBarbarians = NEW_RAGING_BARBARIANS;
  savegame101221.ragingBarbarians = NEW_RAGING_BARBARIANS;
  savegame10213.ragingBarbarians = NEW_RAGING_BARBARIANS;
  savegame103279.ragingBarbarians = NEW_RAGING_BARBARIANS;
  expect(savegame10017.ragingBarbarians).toBe(NEW_RAGING_BARBARIANS);
  expect(savegame101135.ragingBarbarians).toBe(NEW_RAGING_BARBARIANS);
  expect(savegame101221.ragingBarbarians).toBe(NEW_RAGING_BARBARIANS);
  expect(savegame10213.ragingBarbarians).toBe(NEW_RAGING_BARBARIANS);
  expect(savegame103279.ragingBarbarians).toBe(NEW_RAGING_BARBARIANS);
});

test('Get random personalities', () => {
  expect(savegame10017.randomPersonalities).toBe(false);
  expect(savegame101135.randomPersonalities).toBe(false);
  expect(savegame101221.randomPersonalities).toBe(false);
  expect(savegame10213.randomPersonalities).toBe(false);
  expect(savegame103279.randomPersonalities).toBe(true);
});

test('Set random personalities', async () => {
  savegame10017.randomPersonalities = NEW_RANDOM_PERSONALITIES;
  savegame101135.randomPersonalities = NEW_RANDOM_PERSONALITIES;
  savegame101221.randomPersonalities = NEW_RANDOM_PERSONALITIES;
  savegame10213.randomPersonalities = NEW_RANDOM_PERSONALITIES;
  savegame103279.randomPersonalities = NEW_RANDOM_PERSONALITIES;
  expect(savegame10017.randomPersonalities).toBe(NEW_RANDOM_PERSONALITIES);
  expect(savegame101135.randomPersonalities).toBe(NEW_RANDOM_PERSONALITIES);
  expect(savegame101221.randomPersonalities).toBe(NEW_RANDOM_PERSONALITIES);
  expect(savegame10213.randomPersonalities).toBe(NEW_RANDOM_PERSONALITIES);
  expect(savegame103279.randomPersonalities).toBe(NEW_RANDOM_PERSONALITIES);
});

test('Get turn timer enabled', () => {
  expect(savegame10017.turnTimerEnabled).toBe(false);
  expect(savegame101135.turnTimerEnabled).toBe(false);
  expect(savegame101221.turnTimerEnabled).toBe(false);
  expect(savegame10213.turnTimerEnabled).toBe(false);
  expect(savegame103279.turnTimerEnabled).toBe(true);
});

test('Set turn timer enabled', async () => {
  savegame10017.turnTimerEnabled = NEW_TURN_TIMER_ENABLED;
  savegame101135.turnTimerEnabled = NEW_TURN_TIMER_ENABLED;
  savegame101221.turnTimerEnabled = NEW_TURN_TIMER_ENABLED;
  savegame10213.turnTimerEnabled = NEW_TURN_TIMER_ENABLED;
  savegame103279.turnTimerEnabled = NEW_TURN_TIMER_ENABLED;
  expect(savegame10017.turnTimerEnabled).toBe(NEW_TURN_TIMER_ENABLED);
  expect(savegame101135.turnTimerEnabled).toBe(NEW_TURN_TIMER_ENABLED);
  expect(savegame101221.turnTimerEnabled).toBe(NEW_TURN_TIMER_ENABLED);
  expect(savegame10213.turnTimerEnabled).toBe(NEW_TURN_TIMER_ENABLED);
  expect(savegame103279.turnTimerEnabled).toBe(NEW_TURN_TIMER_ENABLED);
});

test('Get turn mode', () => {
  expect(savegame10017.turnMode).toBe(Civ5Save.TURN_MODES.SEQUENTIAL);
  expect(savegame101135.turnMode).toBe(Civ5Save.TURN_MODES.SEQUENTIAL);
  expect(savegame101221.turnMode).toBe(Civ5Save.TURN_MODES.SEQUENTIAL);
  expect(savegame10213.turnMode).toBe(Civ5Save.TURN_MODES.SEQUENTIAL);
  expect(savegame103279.turnMode).toBe(Civ5Save.TURN_MODES.HYBRID);
});

test('Set turn mode', async () => {
  savegame10017.turnMode = Civ5Save.TURN_MODES.HYBRID;
  savegame101135.turnMode = Civ5Save.TURN_MODES.SIMULTANEOUS;
  savegame101221.turnMode = Civ5Save.TURN_MODES.SEQUENTIAL;
  savegame10213.turnMode = NEW_TURN_MODE;
  savegame103279.turnMode = NEW_TURN_MODE;
  expect(savegame10017.turnMode).toBe(Civ5Save.TURN_MODES.HYBRID);
  expect(savegame101135.turnMode).toBe(Civ5Save.TURN_MODES.SIMULTANEOUS);
  expect(savegame101221.turnMode).toBe(Civ5Save.TURN_MODES.SEQUENTIAL);
  expect(savegame10213.turnMode).toBe(NEW_TURN_MODE);
  expect(savegame103279.turnMode).toBe(NEW_TURN_MODE);
});

test('Get max turns', () => {
  expect(savegame10017.maxTurns).toBe(500);
  expect(savegame101135.maxTurns).toBe(1500);
  expect(savegame101221.maxTurns).toBe(100);
  expect(savegame10213.maxTurns).toBe(500);
  expect(savegame103279.maxTurns).toBe(0);
});

test('Set max turns', () => {
  savegame10017.maxTurns = NEW_MAX_TURNS;
  savegame101135.maxTurns = NEW_MAX_TURNS;
  savegame101221.maxTurns = NEW_MAX_TURNS;
  savegame10213.maxTurns = NEW_MAX_TURNS;
  savegame103279.maxTurns = NEW_MAX_TURNS;
  expect(savegame10017.maxTurns).toBe(NEW_MAX_TURNS);
  expect(savegame101135.maxTurns).toBe(NEW_MAX_TURNS);
  expect(savegame101221.maxTurns).toBe(NEW_MAX_TURNS);
  expect(savegame10213.maxTurns).toBe(NEW_MAX_TURNS);
  expect(savegame103279.maxTurns).toBe(NEW_MAX_TURNS);
});

test('Get turn timer length', () => {
  expect(savegame10017.turnTimerLength).toBe(0);
  expect(savegame101135.turnTimerLength).toBe(0);
  expect(savegame101221.turnTimerLength).toBe(0);
  expect(savegame10213.turnTimerLength).toBe(0);
  expect(savegame103279.turnTimerLength).toBe(123);
});

test('Set turn timer length', () => {
  savegame10017.turnTimerLength = NEW_TURN_TIMER_VALUE;
  savegame101135.turnTimerLength = NEW_TURN_TIMER_VALUE;
  savegame101221.turnTimerLength = NEW_TURN_TIMER_VALUE;
  savegame10213.turnTimerLength = NEW_TURN_TIMER_VALUE;
  savegame103279.turnTimerLength = NEW_TURN_TIMER_VALUE;
  expect(savegame10017.turnTimerLength).toBe(NEW_TURN_TIMER_VALUE);
  expect(savegame101135.turnTimerLength).toBe(NEW_TURN_TIMER_VALUE);
  expect(savegame101221.turnTimerLength).toBe(NEW_TURN_TIMER_VALUE);
  expect(savegame10213.turnTimerLength).toBe(NEW_TURN_TIMER_VALUE);
  expect(savegame103279.turnTimerLength).toBe(NEW_TURN_TIMER_VALUE);
});

test('Get private game', () => {
  expect(savegame10017.privateGame).not.toBeDefined();
  expect(savegame101135.privateGame).not.toBeDefined();
  expect(savegame101221.privateGame).not.toBeDefined();
  expect(savegame10213.privateGame).toBe(false);
  expect(savegame103279.privateGame).toBe(true);
});

test('Set private game', () => {
  savegame10213.privateGame = NEW_PRIVATE_GAME;
  savegame103279.privateGame = NEW_PRIVATE_GAME;
  expect(savegame10213.privateGame).toBe(NEW_PRIVATE_GAME);
  expect(savegame103279.privateGame).toBe(NEW_PRIVATE_GAME);
});

test('Get time victory', () => {
  expect(savegame10017.timeVictory).toBe(true);
  expect(savegame101135.timeVictory).toBe(true);
  expect(savegame101221.timeVictory).toBe(true);
  expect(savegame10213.timeVictory).toBe(true);
  expect(savegame103279.timeVictory).toBe(false);
});

test('Set time victory', () => {
  savegame10017.timeVictory = NEW_TIME_VICTORY;
  savegame101135.timeVictory = NEW_TIME_VICTORY;
  savegame101221.timeVictory = NEW_TIME_VICTORY;
  savegame10213.timeVictory = NEW_TIME_VICTORY;
  savegame103279.timeVictory = NEW_TIME_VICTORY;
  expect(savegame10017.timeVictory).toBe(NEW_TIME_VICTORY);
  expect(savegame101135.timeVictory).toBe(NEW_TIME_VICTORY);
  expect(savegame101221.timeVictory).toBe(NEW_TIME_VICTORY);
  expect(savegame10213.timeVictory).toBe(NEW_TIME_VICTORY);
  expect(savegame103279.timeVictory).toBe(NEW_TIME_VICTORY);
});

test('Get science victory', () => {
  expect(savegame10017.scienceVictory).toBe(true);
  expect(savegame101135.scienceVictory).toBe(true);
  expect(savegame101221.scienceVictory).toBe(false);
  expect(savegame10213.scienceVictory).toBe(true);
  expect(savegame103279.scienceVictory).toBe(true);
});

test('Set science victory', () => {
  savegame10017.scienceVictory = NEW_SCIENCE_VICTORY;
  savegame101135.scienceVictory = NEW_SCIENCE_VICTORY;
  savegame101221.scienceVictory = NEW_SCIENCE_VICTORY;
  savegame10213.scienceVictory = NEW_SCIENCE_VICTORY;
  savegame103279.scienceVictory = NEW_SCIENCE_VICTORY;
  expect(savegame101221.scienceVictory).toBe(NEW_SCIENCE_VICTORY);
  expect(savegame10017.scienceVictory).toBe(NEW_SCIENCE_VICTORY);
  expect(savegame101135.scienceVictory).toBe(NEW_SCIENCE_VICTORY);
  expect(savegame10213.scienceVictory).toBe(NEW_SCIENCE_VICTORY);
  expect(savegame103279.scienceVictory).toBe(NEW_SCIENCE_VICTORY);
});

test('Get domination victory', () => {
  expect(savegame10017.dominationVictory).toBe(true);
  expect(savegame101135.dominationVictory).toBe(true);
  expect(savegame101221.dominationVictory).toBe(false);
  expect(savegame10213.dominationVictory).toBe(true);
  expect(savegame103279.dominationVictory).toBe(false);
});

test('Set domination victory', () => {
  savegame10017.dominationVictory = NEW_DOMINATION_VICTORY;
  savegame101135.dominationVictory = NEW_DOMINATION_VICTORY;
  savegame101221.dominationVictory = NEW_DOMINATION_VICTORY;
  savegame10213.dominationVictory = NEW_DOMINATION_VICTORY;
  savegame103279.dominationVictory = NEW_DOMINATION_VICTORY;
  expect(savegame10017.dominationVictory).toBe(NEW_DOMINATION_VICTORY);
  expect(savegame101135.dominationVictory).toBe(NEW_DOMINATION_VICTORY);
  expect(savegame101221.dominationVictory).toBe(NEW_DOMINATION_VICTORY);
  expect(savegame10213.dominationVictory).toBe(NEW_DOMINATION_VICTORY);
  expect(savegame103279.dominationVictory).toBe(NEW_DOMINATION_VICTORY);
});

test('Get cultural victory', () => {
  expect(savegame10017.culturalVictory).toBe(true);
  expect(savegame101135.culturalVictory).toBe(true);
  expect(savegame101221.culturalVictory).toBe(false);
  expect(savegame10213.culturalVictory).toBe(true);
  expect(savegame103279.culturalVictory).toBe(true);
});

test('Set cultural victory', () => {
  savegame10017.culturalVictory = NEW_CULTURAL_VICTORY;
  savegame101135.culturalVictory = NEW_CULTURAL_VICTORY;
  savegame101221.culturalVictory = NEW_CULTURAL_VICTORY;
  savegame10213.culturalVictory = NEW_CULTURAL_VICTORY;
  savegame103279.culturalVictory = NEW_CULTURAL_VICTORY;
  expect(savegame10017.culturalVictory).toBe(NEW_CULTURAL_VICTORY);
  expect(savegame101135.culturalVictory).toBe(NEW_CULTURAL_VICTORY);
  expect(savegame101221.culturalVictory).toBe(NEW_CULTURAL_VICTORY);
  expect(savegame10213.culturalVictory).toBe(NEW_CULTURAL_VICTORY);
  expect(savegame103279.culturalVictory).toBe(NEW_CULTURAL_VICTORY);
});

test('Get diplomatic victory', () => {
  expect(savegame10017.diplomaticVictory).toBe(true);
  expect(savegame101135.diplomaticVictory).toBe(true);
  expect(savegame101221.diplomaticVictory).toBe(false);
  expect(savegame10213.diplomaticVictory).toBe(true);
  expect(savegame103279.diplomaticVictory).toBe(false);
});

test('Set diplomatic victory', () => {
  savegame10017.diplomaticVictory = NEW_DIPLOMATIC_VICTORY;
  savegame101135.diplomaticVictory = NEW_DIPLOMATIC_VICTORY;
  savegame101221.diplomaticVictory = NEW_DIPLOMATIC_VICTORY;
  savegame10213.diplomaticVictory = NEW_DIPLOMATIC_VICTORY;
  savegame103279.diplomaticVictory = NEW_DIPLOMATIC_VICTORY;
  expect(savegame10017.diplomaticVictory).toBe(NEW_DIPLOMATIC_VICTORY);
  expect(savegame101135.diplomaticVictory).toBe(NEW_DIPLOMATIC_VICTORY);
  expect(savegame101221.diplomaticVictory).toBe(NEW_DIPLOMATIC_VICTORY);
  expect(savegame10213.diplomaticVictory).toBe(NEW_DIPLOMATIC_VICTORY);
  expect(savegame103279.diplomaticVictory).toBe(NEW_DIPLOMATIC_VICTORY);
});

test('Save to blob', async () => {
  let newSavegameFile = savegame103279.toBlob();
  let newSavegame = await Civ5Save.fromFile(newSavegameFile);

  expect(newSavegame.alwaysPeace).toBe(NEW_ALWAYS_PEACE);
  expect(newSavegame.alwaysWar).toBe(NEW_ALWAYS_WAR);
  expect(newSavegame.completeKills).toBe(NEW_COMPLETE_KILLS);
  expect(newSavegame.culturalVictory).toBe(NEW_CULTURAL_VICTORY);
  expect(newSavegame.diplomaticVictory).toBe(NEW_DIPLOMATIC_VICTORY);
  expect(newSavegame.dominationVictory).toBe(NEW_DOMINATION_VICTORY);
  expect(newSavegame.lockMods).toBe(NEW_LOCK_MODS);
  expect(newSavegame.maxTurns).toBe(NEW_MAX_TURNS);
  expect(newSavegame.newRandomSeed).toBe(NEW_NEW_RANDOM_SEED);
  expect(newSavegame.noBarbarians).toBe(NEW_NO_BARBARIANS);
  expect(newSavegame.noChangingWarPeace).toBe(NEW_NO_CHANGING_WAR_OR_PEACE);
  expect(newSavegame.noCityRazing).toBe(NEW_NO_CITY_RAZING);
  expect(newSavegame.noCultureOverviewUI).toBe(NEW_NO_CULTURE_OVERVIEW_UI);
  expect(newSavegame.noEspionage).toBe(NEW_NO_ESPIONAGE);
  expect(newSavegame.noHappiness).toBe(NEW_NO_HAPPINESS);
  expect(newSavegame.noPolicies).toBe(NEW_NO_POLICIES);
  expect(newSavegame.noReligion).toBe(NEW_NO_RELIGION);
  expect(newSavegame.noScience).toBe(NEW_NO_SCIENCE);
  expect(newSavegame.noWorldCongress).toBe(NEW_NO_WORLD_CONGRESS);
  expect(newSavegame.oneCityChallenge).toBe(NEW_ONE_CITY_CHALLENGE);
  expect(newSavegame.pitboss).toBe(NEW_PITBOSS);
  expect(newSavegame.policySaving).toBe(NEW_POLICY_SAVING);
  expect(newSavegame.privateGame).toBe(NEW_PRIVATE_GAME);
  expect(newSavegame.promotionSaving).toBe(NEW_PROMOTION_SAVING);
  expect(newSavegame.ragingBarbarians).toBe(NEW_RAGING_BARBARIANS);
  expect(newSavegame.randomPersonalities).toBe(NEW_RANDOM_PERSONALITIES);
  expect(newSavegame.scienceVictory).toBe(NEW_SCIENCE_VICTORY);
  expect(newSavegame.timeVictory).toBe(NEW_TIME_VICTORY);
  expect(newSavegame.turnTimerEnabled).toBe(NEW_TURN_TIMER_ENABLED);
  expect(newSavegame.turnTimerLength).toBe(NEW_TURN_TIMER_VALUE);
  expect(newSavegame.turnMode).toBe(NEW_TURN_MODE);
});

test('Open broken save game', async () => {
  let fileBlob = await getFileBlob(TEST_SAVEGAME_BROKEN);
  await expect(Civ5Save.fromFile(fileBlob)).rejects.toBeDefined();
});

// https://github.com/bmaupin/civ5save-editor/issues/3
test('Test issue 3 (section19SkipSavePath)', async () => {
  let fileBlob = await getFileBlob(path.join(__dirname, 'resources', 'issue3.Civ5Save'));
  let savegame = await Civ5Save.fromFile(fileBlob);
  expect(savegame.maxTurns).toBe(330);
});

// https://github.com/bmaupin/civ5save-editor/issues/4
test('Test issue 4 (gameBuild)', async () => {
  let fileBlob = await getFileBlob(path.join(__dirname, 'resources', 'issue4.Civ5Save'));
  let savegame = await Civ5Save.fromFile(fileBlob);
  expect(savegame.gameBuild).toBe('403694');
  expect(savegame.maxTurns).toBe(500);
});

// https://github.com/bmaupin/civ5save-editor/issues/6
test('Test issue 6', async () => {
  let fileBlob = await getFileBlob(path.join(__dirname, 'resources', 'issue6.Civ5Save'));
  let savegame = await Civ5Save.fromFile(fileBlob);
  expect(savegame.maxTurns).toBe(0);
});

// https://github.com/bmaupin/civ5save-editor/issues/8
test('Test issue 8', async () => {
  let fileBlob = await getFileBlob(path.join(__dirname, 'resources', 'issue8.Civ5Save'));
  let savegame = await Civ5Save.fromFile(fileBlob);
  expect(savegame.enabledMods).toEqual([
    '(1) Community Patch',
    '(2) Community Balance Overhaul',
    '(3) City-State Diplomacy Mod for CBP',
    '(4) C4DF - CBP',
    '(5) More Luxuries - CBO Edition (5-14b)',
  ]);
  expect(savegame.timeVictory).toBe(true);
  expect(savegame.noWorldCongress).toBe(false);
});

// https://github.com/bmaupin/civ5save-editor/issues/15
test('Test issue 15', async () => {
  let fileBlob = await getFileBlob(path.join(__dirname, 'resources', 'issue15.Civ5Save'));
  let savegame = await Civ5Save.fromFile(fileBlob);
  expect(savegame.gameVersion).toBe('1.0.3.279 (180925)');
  expect(savegame.gameBuild).toBe('403694');
  expect(savegame.maxTurns).toBe(330);
});


text:
namespace phi {

template <typename T, typename Context>
void MeanRawKernel(const Context& dev_ctx,
                   const DenseTensor& x,
                   const IntArray& dims,
                   bool keep_dim,
                   bool reduce_all,
                   DenseTensor* out) {
  reduce_all = recompute_reduce_all(x, dims, reduce_all);
  int r = XPUReduce<Context, T>(dev_ctx,
                                x,
                                dims.GetData(),
                                keep_dim,
                                reduce_all,
                                out,
                                xpu::reduce_mean<T>);
  PADDLE_ENFORCE_XDNN_SUCCESS(r, "reduce_mean");
}

}  // namespace phi

PD_REGISTER_KERNEL(mean_raw, XPU, ALL_LAYOUT, phi::MeanRawKernel, float) {}


text:
#ifndef __INC_HAL8192CU_PHY_IMG_H
#define __INC_HAL8192CU_PHY_IMG_H

/*Created on  2011/ 6/29, 10:30*/

#define Rtl8192CUPHY_REG_2TArrayLength 374
extern u4Byte Rtl8192CUPHY_REG_2TArray[Rtl8192CUPHY_REG_2TArrayLength];
#define Rtl8192CUPHY_REG_1TArrayLength 374
extern u4Byte Rtl8192CUPHY_REG_1TArray[Rtl8192CUPHY_REG_1TArrayLength];
#define Rtl8192CUPHY_ChangeTo_1T1RArrayLength 1
extern u4Byte Rtl8192CUPHY_ChangeTo_1T1RArray[Rtl8192CUPHY_ChangeTo_1T1RArrayLength];
#define Rtl8192CUPHY_ChangeTo_1T2RArrayLength 1
extern u4Byte Rtl8192CUPHY_ChangeTo_1T2RArray[Rtl8192CUPHY_ChangeTo_1T2RArrayLength];
#define Rtl8192CUPHY_ChangeTo_2T2RArrayLength 1
extern u4Byte Rtl8192CUPHY_ChangeTo_2T2RArray[Rtl8192CUPHY_ChangeTo_2T2RArrayLength];
#define Rtl8192CUPHY_REG_Array_PGLength 336
extern u4Byte Rtl8192CUPHY_REG_Array_PG[Rtl8192CUPHY_REG_Array_PGLength];
#define Rtl8192CUPHY_REG_Array_PG_mCardLength 336
extern u4Byte Rtl8192CUPHY_REG_Array_PG_mCard[Rtl8192CUPHY_REG_Array_PG_mCardLength];
#define Rtl8192CUPHY_REG_Array_MPLength 4
extern u4Byte Rtl8192CUPHY_REG_Array_MP[Rtl8192CUPHY_REG_Array_MPLength];
#define Rtl8192CUPHY_REG_1T_HPArrayLength 378
extern u4Byte Rtl8192CUPHY_REG_1T_HPArray[Rtl8192CUPHY_REG_1T_HPArrayLength];
#define Rtl8192CUPHY_REG_1T_mCardArrayLength 374
extern u4Byte Rtl8192CUPHY_REG_1T_mCardArray[Rtl8192CUPHY_REG_1T_mCardArrayLength];
#define Rtl8192CUPHY_REG_2T_mCardArrayLength 374
extern u4Byte Rtl8192CUPHY_REG_2T_mCardArray[Rtl8192CUPHY_REG_2T_mCardArrayLength];
#define Rtl8192CUPHY_REG_Array_PG_HPLength 336
extern u4Byte Rtl8192CUPHY_REG_Array_PG_HP[Rtl8192CUPHY_REG_Array_PG_HPLength];
#define Rtl8192CURadioA_2TArrayLength 282
extern u4Byte Rtl8192CURadioA_2TArray[Rtl8192CURadioA_2TArrayLength];
#define Rtl8192CURadioB_2TArrayLength 78
extern u4Byte Rtl8192CURadioB_2TArray[Rtl8192CURadioB_2TArrayLength];
#define Rtl8192CURadioA_1TArrayLength 282
extern u4Byte Rtl8192CURadioA_1TArray[Rtl8192CURadioA_1TArrayLength];
#define Rtl8192CURadioB_1TArrayLength 1
extern u4Byte Rtl8192CURadioB_1TArray[Rtl8192CURadioB_1TArrayLength];
#define Rtl8192CURadioA_2T_mCardArrayLength 282
extern u4Byte Rtl8192CURadioA_2T_mCardArray[Rtl8192CURadioA_2T_mCardArrayLength];
#define Rtl8192CURadioB_2T_mCardArrayLength 78
extern u4Byte Rtl8192CURadioB_2T_mCardArray[Rtl8192CURadioB_2T_mCardArrayLength];
#define Rtl8192CURadioA_1T_mCardArrayLength 282
extern u32 Rtl8192CURadioA_1T_mCardArray[Rtl8192CURadioA_1T_mCardArrayLength];
#define Rtl8192CURadioB_1T_mCardArrayLength 1
extern u32 Rtl8192CURadioB_1T_mCardArray[Rtl8192CURadioB_1T_mCardArrayLength];
#define Rtl8192CURadioA_1T_HPArrayLength 282
extern u4Byte Rtl8192CURadioA_1T_HPArray[Rtl8192CURadioA_1T_HPArrayLength];
#define Rtl8192CURadioB_GM_ArrayLength 1
extern u4Byte Rtl8192CURadioB_GM_Array[Rtl8192CURadioB_GM_ArrayLength];
#define Rtl8192CUMACPHY_Array_PGLength 1
extern u4Byte Rtl8192CUMACPHY_Array_PG[Rtl8192CUMACPHY_Array_PGLength];
#define Rtl8192CUAGCTAB_2TArrayLength 320
extern u4Byte Rtl8192CUAGCTAB_2TArray[Rtl8192CUAGCTAB_2TArrayLength];
#define Rtl8192CUAGCTAB_1TArrayLength 320
extern u4Byte Rtl8192CUAGCTAB_1TArray[Rtl8192CUAGCTAB_1TArrayLength];
#define Rtl8192CUAGCTAB_1T_HPArrayLength 320
extern u4Byte Rtl8192CUAGCTAB_1T_HPArray[Rtl8192CUAGCTAB_1T_HPArrayLength];

#endif //__INC_HAL8192CU_FW_IMG_H


text:
package com.programmerdan.minecraft.banstick.handler;

import com.programmerdan.minecraft.banstick.BanStick;
import com.programmerdan.minecraft.banstick.data.BSBan;
import com.programmerdan.minecraft.banstick.data.BSIP;
import com.programmerdan.minecraft.banstick.data.BSIPData;
import com.programmerdan.minecraft.banstick.data.BSLog;
import com.programmerdan.minecraft.banstick.data.BSPlayer;
import com.programmerdan.minecraft.banstick.data.BSSession;
import com.programmerdan.minecraft.banstick.data.BSShare;
import java.net.InetAddress;
import java.util.List;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
import vg.civcraft.mc.civmodcore.dao.ManagedDatasource;

/**
 * Ties into the managed datasource processes of the CivMod core plugin.
 *
 * @author ProgrammerDan
 *
 */
public class BanStickDatabaseHandler {

	private ManagedDatasource data;

	public ManagedDatasource getData() {
		return this.data;
	}

	private static BanStickDatabaseHandler instance;

	public static BanStickDatabaseHandler getInstance() {
		return BanStickDatabaseHandler.instance;
	}

	public static ManagedDatasource getinstanceData() {
		return BanStickDatabaseHandler.instance.data;
	}

	public BanStickDatabaseHandler(FileConfiguration config) {
		if (!configureData(config.getConfigurationSection("database"))) {
			throw new RuntimeException("Failed to configure Database for BanStick!");
		}
		BanStickDatabaseHandler.instance = this;
	}

	private boolean configureData(ConfigurationSection config) {
		String host = config.getString("host", "localhost");
		int port = config.getInt("port", 3306);
		String dbname = config.getString("database", "banstick");
		String username = config.getString("user");
		String password = config.getString("password");
		int poolsize = config.getInt("poolsize", 5);
		long connectionTimeout = config.getLong("connection_timeout", 10000l);
		long idleTimeout = config.getLong("idle_timeout", 600000l);
		long maxLifetime = config.getLong("max_lifetime", 7200000l);
		try {
			data = new ManagedDatasource(BanStick.getPlugin(), username, password, host, port, dbname,
					poolsize, connectionTimeout, idleTimeout, maxLifetime);
			data.getConnection().close();
		} catch (Exception se) {
			BanStick.getPlugin().info("Failed to initialize Database connection");
			se.printStackTrace();
			return false;
		}

		initializeTables();
		stageUpdates();

		long begin_time = System.currentTimeMillis();

		try {
			BanStick.getPlugin().info("Update prepared, starting database update.");
			if (!data.updateDatabase()) {
				BanStick.getPlugin().info( "Update failed, disabling plugin.");
				return false;
			}
		} catch (Exception e) {
			BanStick.getPlugin().severe("Update failed, disabling plugin. Cause:", e);
			return false;
		}

		BanStick.getPlugin().info(String.format("Database update took %d seconds", (System.currentTimeMillis() - begin_time) / 1000));

		activatePreload(config.getConfigurationSection("preload"));
		activateDirtySave(config.getConfigurationSection("dirtysave"));
		return true;
	}

	private void activateDirtySave(ConfigurationSection config) {
		long period = 5*60*50l;
		long delay = 5*60*50l;
		if (config != null) {
			period = config.getLong("period", period);
			delay = config.getLong("delay", delay);
		}
		BanStick.getPlugin().debug("DirtySave Period {0} Delay {1}", period, delay);

		Bukkit.getScheduler().runTaskTimerAsynchronously(BanStick.getPlugin(), new Runnable() {
			@Override
			public void run() {
				BanStick.getPlugin().debug("Player dirty save");
				BSPlayer.saveDirty();
			}
		}, delay, period);

		Bukkit.getScheduler().runTaskTimerAsynchronously(BanStick.getPlugin(), new Runnable() {
			@Override
			public void run() {
				BanStick.getPlugin().debug("Ban dirty save");
				BSBan.saveDirty();
			}
		}, delay + (period / 5), period);

		Bukkit.getScheduler().runTaskTimerAsynchronously(BanStick.getPlugin(), new Runnable() {
			@Override
			public void run() {
				BanStick.getPlugin().debug("Session dirty save");
				BSSession.saveDirty();
			}
		}, delay + ((period * 2) / 5), period);

		Bukkit.getScheduler().runTaskTimerAsynchronously(BanStick.getPlugin(), new Runnable() {
			@Override
			public void run() {
				BanStick.getPlugin().debug("Share dirty save");
				BSShare.saveDirty();
			}
		}, delay + ((period * 3) / 5), period);

		Bukkit.getScheduler().runTaskTimerAsynchronously(BanStick.getPlugin(), new Runnable() {
			@Override
			public void run() {
				BanStick.getPlugin().debug("Proxy dirty save");
				BSIPData.saveDirty();
			}
		}, delay + ((period * 4) / 5), period);

		BanStick.getPlugin().info("Dirty save tasks started.");
	}

	private void activatePreload(ConfigurationSection config) {
		if (config != null && config.getBoolean("enabled")) {
			long period = 5*60*50l;
			long delay = 5*60*50l;
			period = config.getLong("period", period);
			delay = config.getLong("delay", delay);
			final int batchsize = config.getInt("batch", 100);

			BanStick.getPlugin().debug("Preload Period {0} Delay {1} batch {2}", period, delay, batchsize);

			new BukkitRunnable() {
				private long lastId = 0l;
				@Override
				public void run() {
					BanStick.getPlugin().debug("IP preload {0}, lim {1}", lastId, batchsize);
					lastId = BSIP.preload(lastId, batchsize);
					if (lastId < 0) this.cancel();
				}
			}.runTaskTimerAsynchronously(BanStick.getPlugin(), delay, period);

			new BukkitRunnable() {
				private long lastId = 0l;
				@Override
				public void run() {
					BanStick.getPlugin().debug("Proxy preload {0}, lim {1}", lastId, batchsize);
					lastId = BSIPData.preload(lastId, batchsize);
					if (lastId < 0) this.cancel();
				}
			}.runTaskTimerAsynchronously(BanStick.getPlugin(), delay + (period / 6), period);

			new BukkitRunnable() {
				private long lastId = 0l;
				@Override
				public void run() {
					BanStick.getPlugin().debug("Ban preload {0}, lim {1}", lastId, batchsize);
					lastId = BSBan.preload(lastId, batchsize, false);
					if (lastId < 0) this.cancel();
				}
			}.runTaskTimerAsynchronously(BanStick.getPlugin(), delay + ((period * 2) / 6), period);

			new BukkitRunnable() {
				private long lastId = 0l;
				@Override
				public void run() {
					BanStick.getPlugin().debug("Player preload {0}, lim {1}", lastId, batchsize);
					lastId = BSPlayer.preload(lastId, batchsize);
					if (lastId < 0) this.cancel();
				}
			}.runTaskTimerAsynchronously(BanStick.getPlugin(), delay + ((period * 3) / 6), period);

			new BukkitRunnable() {
				private long lastId = 0l;
				@Override
				public void run() {
					BanStick.getPlugin().debug("Session preload {0}, lim {1}", lastId, batchsize);
					lastId = BSSession.preload(lastId, batchsize);
					if (lastId < 0) this.cancel();
				}
			}.runTaskTimerAsynchronously(BanStick.getPlugin(), delay + ((period * 4) / 6), period);

			new BukkitRunnable() {
				private long lastId = 0l;
				@Override
				public void run() {
					BanStick.getPlugin().debug("Share preload {0}, lim {1}", lastId, batchsize);
					lastId = BSShare.preload(lastId, batchsize);
					if (lastId < 0) this.cancel();
				}
			}.runTaskTimerAsynchronously(BanStick.getPlugin(), delay + ((period * 5) / 6), period);
		} else {
			BanStick.getPlugin().info("Preloading is disabled. Expect more lag on joins, lookups, and bans.");
		}

	}

	/**
	 * Basic method to set up data model v1.
	 */
	private void initializeTables() {
		data.registerMigration(0,  false,
					"CREATE TABLE IF NOT EXISTS bs_player (" +
					" pid BIGINT AUTO_INCREMENT PRIMARY KEY," +
					" name VARCHAR(16)," +
					" uuid CHAR(36) NOT NULL UNIQUE," +
					" first_add TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP," +
					" bid BIGINT REFERENCES bs_ban(bid)," +
					" ip_pardon_time TIMESTAMP NULL, " +
					" proxy_pardon_time TIMESTAMP NULL," +
					" shared_pardon_time TIMESTAMP NULL," +
					" INDEX bs_player_name (name)," +
					" INDEX bs_player_ip_pardons (ip_pardon_time)," +
					" INDEX bs_player_proxy_pardons (proxy_pardon_time)," +
					" INDEX bs_player_shared_pardons (shared_pardon_time)," +
					" INDEX bs_player_join (first_add)" +
					");",
					"CREATE TABLE IF NOT EXISTS bs_session (" +
					" sid BIGINT AUTO_INCREMENT PRIMARY KEY," +
					" pid BIGINT REFERENCES bs_player(pid)," +
					" join_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP," +
					" leave_time TIMESTAMP NULL," +
					" iid BIGINT NOT NULL REFERENCES bs_ip(iid)," +
					" INDEX bs_session_pids (pid, join_time, leave_time)" +
					");",
					"CREATE TABLE IF NOT EXISTS bs_ban_log (" +
					" lid BIGINT AUTO_INCREMENT PRIMARY KEY," +
					" pid BIGINT NOT NULL REFERENCES bs_player(pid)," +
					" bid BIGINT NOT NULL REFERENCES bs_ban(bid)," +
					" action_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP," +
					" action VARCHAR(10) NOT NULL," +
					" INDEX bs_ban_log_time (pid, action_time DESC)" +
					");", // TODO: Whenever a ban is given or removed from a player, record.
					"CREATE TABLE IF NOT EXISTS bs_ban (" +
					" bid BIGINT AUTO_INCREMENT PRIMARY KEY," +
					" ban_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP," +
					" ip_ban BIGINT REFERENCES bs_ip(iid)," +
					" proxy_ban BIGINT REFERENCES bs_ip_data(idid)," +
					" share_ban BIGINT REFERENCES bs_share(sid)," +
					" admin_ban BOOLEAN DEFAULT FALSE," +
					" message TEXT," +
					" ban_end TIMESTAMP NULL," +
					" INDEX bs_ban_time (ban_time)," +
					" INDEX bs_ban_ip (ip_ban)," +
					" INDEX bs_ban_proxy (proxy_ban)," +
					" INDEX bs_ban_share (share_ban)," +
					" INDEX bs_ban_end (ban_end)" +
					");",
					"CREATE TABLE IF NOT EXISTS bs_share (" +
					" sid BIGINT AUTO_INCREMENT PRIMARY KEY," +
					" create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP," +
					" first_pid BIGINT NOT NULL REFERENCES bs_player(pid)," +
					" second_pid BIGINT NOT NULL REFERENCES bs_player(pid)," +
					" first_sid BIGINT NOT NULL REFERENCES bs_session(sid)," +
					" second_sid BIGINT NOT NULL REFERENCES bs_session(sid)," +
					" pardon BOOLEAN DEFAULT FALSE," +
					" pardon_time TIMESTAMP NULL," +
					" INDEX bs_share (first_pid, second_pid)," +
					" INDEX bs_pardon (pardon_time)" +
					");",
					"CREATE TABLE IF NOT EXISTS bs_ip (" +
					" iid BIGINT AUTO_INCREMENT PRIMARY KEY," +
					" create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP," +
					" ip4 CHAR(15)," +
					" ip4cidr SMALLINT," +
					" ip6 CHAR(39)," +
					" ip6cidr SMALLINT," +
					" INDEX bs_session_ip4 (ip4, ip4cidr)," +
					" INDEX bs_session_ip6 (ip6, ip6cidr)" +
					");",
					"CREATE TABLE IF NOT EXISTS bs_ip_data (" +
					" idid BIGINT AUTO_INCREMENT PRIMARY KEY," +
					" iid BIGINT NOT NULL REFERENCES bs_ip(iid)," +
					" create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP," +
					" valid BOOLEAN DEFAULT TRUE," +
					" continent TEXT," +
					" country TEXT," +
					" region TEXT," +
					" city TEXT," +
					" postal TEXT," +
					" lat DOUBLE DEFAULT NULL," +
					" lon DOUBLE DEFAULT NULL," +
					" domain TEXT," +
					" provider TEXT," +
					" registered_as TEXT," +
					" connection TEXT," +
					" proxy FLOAT," +
					" source TEXT," +
					" comment TEXT," +
					" INDEX bs_ip_data_iid (iid)," +
					" INDEX bs_ip_data_valid (valid, create_time DESC)," +
					" INDEX bs_ip_data_proxy (proxy)" +
					");"
				);
		data.registerMigration(1,  false, "CREATE TABLE IF NOT EXISTS bs_exclusion ("
		        + "eid BIGINT AUTO_INCREMENT PRIMARY KEY,"
	            + "create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,"
                + "first_pid BIGINT NOT NULL REFERENCES bs_player(pid),"
                + "second_pid BIGINT NOT NULL REFERENCES bs_player(pid),"
                + " INDEX bs_exclusion_pid (first_pid, second_pid)"
		        + ");");
		data.registerMigration(2,  false, "CREATE TABLE IF NOT EXISTS bs_banned_registrars ("
		        + "rid BIGINT AUTO_INCREMENT PRIMARY KEY,"
	            + "create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,"
                + "registered_as text"
		        + ");");

	}

	/**
	 * Add all new migrations here.
	 */
	private void stageUpdates() {

	}

	public void doShutdown() {

		BanStick.getPlugin().info("Player dirty save");
		BSPlayer.saveDirty();

		BanStick.getPlugin().info("Ban dirty save");
		BSBan.saveDirty();

		BanStick.getPlugin().info("Session dirty save");
		BSSession.saveDirty();

		BanStick.getPlugin().info("Share dirty save");
		BSShare.saveDirty();

		BanStick.getPlugin().info("Proxy dirty save");
		BSIPData.saveDirty();

		BanStick.getPlugin().info("Ban Log save");
		BSLog log = BanStick.getPlugin().getLogHandler();
		if (log != null) log.disable();
	}

	// ============ QUERIES =============

	public BSPlayer getOrCreatePlayer(final Player player) {
		// TODO: use exception
		BSPlayer bsPlayer = getPlayer(player.getUniqueId());
		if (bsPlayer == null) {
			bsPlayer = BSPlayer.create(player);
		}

		return bsPlayer;
	}

	public BSPlayer getPlayer(final UUID uuid) {
		return BSPlayer.byUUID(uuid); // TODO: exception
	}

	public BSIP getOrCreateIP(final InetAddress netAddress) {
		BSIP bsIP = getIP(netAddress);
		if (bsIP == null) {
			BanStick.getPlugin().debug("Creating IP address: {0}", netAddress);
			bsIP = BSIP.create(netAddress);
		} else {
			BanStick.getPlugin().info("Registering future retrieval of IPData for {0}", bsIP.toString());
			BanStick.getPlugin().getIPDataHandler().offer(bsIP);
		}
		return bsIP;
	}

	public BSIP getIP(final InetAddress netAddress) {
		return BSIP.byInetAddress(netAddress);
	}

	public List<BSIP> getAllByIP(final InetAddress netAddress) {
		return BSIP.allMatching(netAddress);
	}
}


text:
module.exports = function(grunt) {
  "use strict";

  var env = grunt.option('env');

  grunt.registerTask('happyplan:build-assets', 'Build the assets for the website', [
      'copy:cssAsScss'

    // created during runtime
    , 'happyplan:prepare-build-assets'

    // assets
    , 'copy:images'
    , 'happyplan:glyphicons'

    // css
    , 'happyplan:build-styles'

    // js
    , (env === 'dist' ? 'uglify' : 'concat') + ':scripts_' + env
  ])

}


text:
layout: post
title: Busty blonde Sarah Jessie plays with her pussy
titleinfo: pornvd
desc: Watch Busty blonde Sarah Jessie plays with her pussy. Pornhub is the ultimate xxx porn and sex site.
---

Busty blonde Sarah Jessie plays with her pussy

Watch Busty blonde Sarah Jessie plays with her pussy. Pornhub is the ultimate xxx porn and sex site.


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>QueryDescription (Titan 1.0.0 API)</title>
<meta name="date" content="2015-09-19">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

com.thinkaurelius.titan.core

Interface QueryDescription

public interface QueryDescription

Author:

Matthias Broecheler (me@matthiasb.com)

Nested Class Summary

Nested Classes

Modifier and Type
Interface and Description

static interface
QueryDescription.SubQuery

Represents one sub-query of this query.

Method Summary

All Methods Instance Methods Abstract Methods

Modifier and Type
Method and Description

int
getNoCombinedQueries()

Returns how many individual queries are combined into this query, meaning, how many
 queries will be executed in one batch.

int
getNoSubQueries()

Returns the number of sub-queries this query is comprised of.

List<? extends QueryDescription.SubQuery>
getSubQueries()

Returns a list of all sub-queries that comprise this query

String
toString()

Returns a string representation of the entire query

Method Detail

toString

String toString()

Returns a string representation of the entire query

Overrides:

toString in class Object

Returns:

getNoCombinedQueries

int getNoCombinedQueries()

Returns how many individual queries are combined into this query, meaning, how many
 queries will be executed in one batch.

Returns:

getNoSubQueries

int getNoSubQueries()

Returns the number of sub-queries this query is comprised of. Each sub-query represents one OR clause, i.e.,
 the union of each sub-query's result is the overall result.

Returns:

getSubQueries

List<? extends QueryDescription.SubQuery> getSubQueries()

Returns a list of all sub-queries that comprise this query

Returns:

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

Copyright © 2012–2015. All rights reserved.


text:
package com.vav.Common.Graphs;

import java.util.ArrayDeque;
import java.util.Queue;
import java.util.Stack;

/**
 * Created by Vaibhav on 6/5/17.
 */
public class Graph {
    private final int MAX_VERTICES = 20;
    private Vertex[] vertexList;
    private int[][] adjacencyMatrix;
    private int nVerts;
    //Stack for DFS
    private Stack<Integer> stack;
    private Queue<Integer> queue;

    public Graph(){
        stack = new Stack<>();
        queue = new ArrayDeque<>();
        vertexList = new Vertex[MAX_VERTICES];
        adjacencyMatrix = new int[MAX_VERTICES][MAX_VERTICES];
        nVerts = 0;
        for(int i = 0; i < MAX_VERTICES; i++){
            for(int j = 0; j< MAX_VERTICES; j++){
                adjacencyMatrix[i][j] = 0;
            }
        }
    }
    public void addVertex(char label){
        vertexList[nVerts++] = new Vertex(label);
    }
    public void addEdge(int start, int end){
        adjacencyMatrix[start][end] = 1;
        adjacencyMatrix[end][start] = 1;
    }
    public void displayVertex(int vertexPosition){
        System.out.println(vertexList[vertexPosition]);
    }

    public int getAdjascentUnvisitedVertex(int v){
        for(int j=0;j<nVerts;j++) {
            if (adjacencyMatrix[v][j]==1 && vertexList[j].isWasVisited()==false){
                return j;
            }
        }
        return -1;
    }

    /**********Depth first search**************/
    public void dfs(){
        vertexList[0].setWasVisited(true);
        stack.push(0);
        displayVertex(0);
        int nextUnvisitedVertexPosition;
        while(!stack.isEmpty()){
            nextUnvisitedVertexPosition = getAdjascentUnvisitedVertex(stack.peek());
            if(nextUnvisitedVertexPosition!=-1){
                vertexList[nextUnvisitedVertexPosition].setWasVisited(true);
                displayVertex(nextUnvisitedVertexPosition);
                stack.push(nextUnvisitedVertexPosition);
            }else{
                stack.pop();
            }
        }
        for(int i=0;i<vertexList.length;i++){
            vertexList[i].setWasVisited(false);
        }
    }

    /**********Breadth first search**************/
    public void bfs(){
        vertexList[0].setWasVisited(true);
        displayVertex(0);
        queue.add(0);
        int currentVertex;
        while(!queue.isEmpty()){
            int adjascentVertex;
            currentVertex = queue.remove();
            while((adjascentVertex=getAdjascentUnvisitedVertex(currentVertex))!=-1){
                    vertexList[adjascentVertex].setWasVisited(true);
                    displayVertex(adjascentVertex);
                    queue.add(adjascentVertex);
            }
        }
        for(int i=0;i<vertexList.length;i++){
            vertexList[i].setWasVisited(false);
        }
    }

/**********Minimum spanning tree**************/
    public void mst(){
        vertexList[0].setWasVisited(true);
        stack.push(0);
        int currentVertex;
        while (!stack.isEmpty()){
            currentVertex = stack.peek();
            int nextVertex = getAdjascentUnvisitedVertex(currentVertex);
            if(nextVertex !=-1){
                displayVertex(currentVertex);
                displayVertex(nextVertex);
                stack.push(nextVertex);
                vertexList[nextVertex].setWasVisited(true);
            }else{
                stack.pop();
            }
        }
        for(int i=0;i<vertexList.length;i++){
            vertexList[i].setWasVisited(false);
        }
    }

    public void dfs1(){
        vertexList[0].setWasVisited(true);
        stack.push(0);
        displayVertex(0);
        while(!stack.isEmpty()){
            int nextVertex = getAdjascentUnvisitedVertex(stack.peek());
            if(getAdjascentUnvisitedVertex(stack.peek())!=-1){
                vertexList[nextVertex].setWasVisited(true);
                stack.push(nextVertex);
                displayVertex(nextVertex);
            }else{
                stack.pop();
            }
        }
    }
    public void bfs1(){
        vertexList[0].setWasVisited(true);
        queue.add(0);
        displayVertex(0);
        while (!queue.isEmpty()){
            int currentItem = queue.remove();
            int nextVertex;
            while((nextVertex=getAdjascentUnvisitedVertex(currentItem))!=-1){
                queue.add(nextVertex);
                displayVertex(nextVertex);
                vertexList[nextVertex].setWasVisited(true);
            }
        }
    }
}


text:
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=IForEachInterfaceList.js.map


text:
using Pliant.Forest;
using Pliant.Charts;
using Pliant.Grammars;
using Pliant.Tokens;
using System.Collections.Generic;
using Pliant.Utilities;

namespace Pliant.Runtime
{
    /// <summary>
    /// Provides the interface for the earley parse engine.
    /// </summary>
    public interface IParseEngine
    {
        /// <summary>
        /// Resets the parse engine clearing out any current state.
        /// </summary>
        void Reset();

        /// <summary>
        /// Gets the current accepted status of the parse.
        /// </summary>
        /// <returns>true if the parse is in a accepted state / false otherwise. </returns>
        bool IsAccepted();

        /// <summary>
        /// Gets the root of the parse forest.
        /// </summary>
        /// <returns></returns>
        IInternalForestNode GetParseForestRootNode();

        /// <summary>
        /// Returns the list of expected lexer rules based on the current state of the parse.
        /// </summary>
        /// <returns>The enumeration of lexer rules that apply at the current parse position.</returns>
        List<ILexerRule> GetExpectedLexerRules();

        /// <summary>
        /// Accepts one token and incrementally moves the parser forward if successful.
        /// </summary>
        /// <param name="token">The next token to move the parser forward.</param>
        /// <returns>True if the token was accepted, false otherwise.</returns>
        bool Pulse(IToken token);

        /// <summary>
        /// Gets the grammar used by the parse engine.
        /// </summary>
        IGrammar Grammar { get; }

        /// <summary>
        /// Gets the location in the parse. The location is the current token index and not the character index in the parse.
        /// </summary>
        int Location { get; }
    }
}


text:
#include "config.h"
#include "WebScopedUserGesture.h"

#include "WebUserGestureToken.h"
#include "platform/UserGestureIndicator.h"

namespace blink {

void WebScopedUserGesture::initialize()
{
    m_indicator.reset(new WebCore::UserGestureIndicator(WebCore::DefinitelyProcessingNewUserGesture));
}

void WebScopedUserGesture::initializeWithToken(const WebUserGestureToken& token)
{
    if (!token.isNull())
        m_indicator.reset(new WebCore::UserGestureIndicator(token));
}

void WebScopedUserGesture::reset()
{
    m_indicator.reset(0);
}

} // namespace blink


text:
require File.expand_path('../../../shared/rational/abs', __FILE__)

describe "Rational#abs" do
  it_behaves_like(:rational_abs, :magnitude)
end


text:
package org.apache.camel.health;

import java.util.Collections;
import java.util.Map;
import java.util.Optional;

import org.apache.camel.Ordered;
import org.apache.camel.spi.HasGroup;
import org.apache.camel.spi.HasId;

/**
 * Health check
 */
public interface HealthCheck extends HasGroup, HasId, Ordered {

    String CHECK_ID = "check.id";
    String CHECK_GROUP = "check.group";
    String CHECK_KIND = "check.kind";
    String CHECK_ENABLED = "check.enabled";
    String INVOCATION_COUNT = "invocation.count";
    String INVOCATION_TIME = "invocation.time";
    String INVOCATION_ATTEMPT_TIME = "invocation.attempt.time";
    String FAILURE_COUNT = "failure.count";
    String ENDPOINT_URI = "endpoint.uri";
    String FAILURE_ERROR_COUNT = "failure.error.count";
    String SUCCESS_COUNT = "success.count";
    String HTTP_RESPONSE_CODE = "http.response.code";
    /**
     * Use ENDPOINT_URI
     */
    @Deprecated
    String FAILURE_ENDPOINT_URI = "failure.endpoint.uri";

    enum State {
        UP,
        DOWN,
        UNKNOWN
    }

    enum Kind {
        READINESS,
        LIVENESS,
        ALL,
    }

    @Override
    default int getOrder() {
        return Ordered.LOWEST;
    }

    /**
     * Whether this health check is enabled
     */
    boolean isEnabled();

    /**
     * Used for enabling or disabling this health check
     */
    void setEnabled(boolean enabled);

    /**
     * Return metadata associated with this {@link HealthCheck}.
     */
    default Map<String, Object> getMetaData() {
        return Collections.emptyMap();
    }

    /**
     * Whether this health check can be used for readiness checks
     */
    default boolean isReadiness() {
        return true;
    }

    /**
     * Whether this health check can be used for liveness checks
     */
    default boolean isLiveness() {
        return true;
    }

    /**
     * Invoke the check.
     *
     * @see #call(Map)
     */
    default Result call() {
        return call(Collections.emptyMap());
    }

    /**
     * Invoke the check as readiness check.
     *
     * @see #call(Map)
     */
    default Result callReadiness() {
        return call(Map.of(HealthCheck.CHECK_KIND, Kind.READINESS));
    }

    /**
     * Invoke the check as liveness check.
     *
     * @see #call(Map)
     */
    default Result callLiveness() {
        return call(Map.of(HealthCheck.CHECK_KIND, Kind.LIVENESS));
    }

    /**
     * Invoke the check.
     *
     * The implementation is responsible to eventually perform the check according to the limitation of the third party
     * system i.e. it should not be performed too often to avoid rate limiting. The options argument can be used to pass
     * information specific to the check like forcing the check to be performed against the policies. The implementation
     * is responsible to catch and handle any exception thrown by the underlying technology, including unchecked ones.
     */
    Result call(Map<String, Object> options);

    /**
     * Response to a health check invocation.
     */
    interface Result {

        /**
         * The {@link HealthCheck} associated to this response.
         */
        HealthCheck getCheck();

        /**
         * The state of the service.
         */
        State getState();

        /**
         * A message associated to the result, used to provide more information for unhealthy services.
         */
        Optional<String> getMessage();

        /**
         * An error associated to the result, used to provide the error associated to unhealthy services.
         */
        Optional<Throwable> getError();

        /**
         * A key/value combination of details.
         *
         * @return a non null details map (empty if no details)
         */
        Map<String, Object> getDetails();
    }
}


text:
#include "Marlin.h"

#if ENABLED(USE_WATCHDOG)

#include "watchdog.h"

// Initialize watchdog with a 4 sec interrupt time
void watchdog_init() {
  #if ENABLED(WATCHDOG_RESET_MANUAL)
    // We enable the watchdog timer, but only for the interrupt.
    // Take care, as this requires the correct order of operation, with interrupts disabled. See the datasheet of any AVR chip for details.
    wdt_reset();
    _WD_CONTROL_REG = _BV(_WD_CHANGE_BIT) | _BV(WDE);
    _WD_CONTROL_REG = _BV(WDIE) | WDTO_4S;
  #else
    wdt_enable(WDTO_4S);
  #endif
}

//===========================================================================
//=================================== ISR ===================================
//===========================================================================

// Watchdog timer interrupt, called if main program blocks >1sec and manual reset is enabled.
#if ENABLED(WATCHDOG_RESET_MANUAL)
  ISR(WDT_vect) {
    SERIAL_ERROR_START;
    SERIAL_ERRORLNPGM("Something is wrong, please turn off the printer.");
    kill(PSTR("ERR:Please Reset")); //kill blocks //16 characters so it fits on a 16x2 display
    while (1); //wait for user or serial reset
  }
#endif //WATCHDOG_RESET_MANUAL

#endif //USE_WATCHDOG


text:
package io.opensec.oval.model.aix;

import io.opensec.oval.model.ComponentType;
import io.opensec.oval.model.ElementRef;
import io.opensec.oval.model.Family;
import io.opensec.oval.model.definitions.EntityStateStringType;
import io.opensec.oval.model.definitions.StateType;

import java.util.ArrayList;
import java.util.Collection;

import org.mongodb.morphia.annotations.Property;

/**
 * The interim_fix_state defines the different information associated
 * with a specific interim fix installed on the system.
 *
 * @author  Akihito Nakamura, AIST
 * @see OVAL Language
 */
public class InterimFixState
    extends StateType
{

    //{0..1}
    private EntityStateStringType           vuid;
    private EntityStateStringType           level;

    //renamed from "abstract" to "description" because "abstract" is Java reserved word.
    @Property( "abstract" )
    private EntityStateStringType           description;

    private EntityStateInterimFixStateType  state;

    /**
     * Constructor.
     */
    public InterimFixState()
    {
        this( null, 0 );
    }

    public InterimFixState(
                    final String id,
                    final int version
                    )
    {
        this( id, version, null );
    }

    public InterimFixState(
                    final String id,
                    final int version,
                    final String comment
                    )
    {
        super( id, version, comment );

        _oval_family = Family.AIX;
        _oval_component = ComponentType.INTERIM_FIX;
    }

    /**
     */
    public void setVuid(
                    final EntityStateStringType vuid
                    )
    {
        this.vuid = vuid;
    }

    public EntityStateStringType getVuid()
    {
        return vuid;
    }

    /**
     */
    public void setLevel(
                    final EntityStateStringType level
                    )
    {
        this.level = level;
    }

    public EntityStateStringType getLevel()
    {
        return level;
    }

    /**
     */
    public void setAbstract(
                    final EntityStateStringType description
                    )
    {
        this.description = description;
    }

    public EntityStateStringType getAbstract()
    {
        return description;
    }

    /**
     */
    public void setState(
                    final EntityStateInterimFixStateType state
                    )
    {
        this.state = state;
    }

    public EntityStateInterimFixStateType getState()
    {
        return state;
    }

    //*********************************************************************
    //  DefinitionsElement
    //*********************************************************************

    @Override
    public Collection<ElementRef> ovalGetElementRef()
    {
        Collection<ElementRef>  ref_list = new ArrayList<ElementRef>();
        ref_list.add( getVuid() );
        ref_list.add( getLevel() );
        ref_list.add( getAbstract() );
        ref_list.add( getState() );

        return ref_list;
    }

    //**************************************************************
    //  java.lang.Object
    //**************************************************************

    @Override
    public int hashCode()
    {
        return super.hashCode();
    }

    @Override
    public boolean equals(
                    final Object obj
                    )
    {
        if (!(obj instanceof InterimFixState)) {
            return false;
        }

        return super.equals( obj );
    }

    @Override
    public String toString()
    {
        return "interim_fix_state[" + super.toString()
                        + ", vuid="     + getVuid()
                        + ", level="    + getLevel()
                        + ", abstract=" + getAbstract()
                        + ", state="    + getState()
             + "]";
    }

}
//


text:
<?php

namespace Tests\unit\WindowsAzure\Common\Models;

use WindowsAzure\Common\Models\GetServicePropertiesResult;
use WindowsAzure\Common\Models\ServiceProperties;
use Tests\Framework\TestResources;

/**
 * Unit tests for class GetServicePropertiesResult.
 *
 * @category  Microsoft
 *
 * @author    Azure PHP SDK <azurephpsdk@microsoft.com>
 * @copyright 2012 Microsoft Corporation
 * @license   http://www.apache.org/licenses/LICENSE-2.0  Apache License 2.0
 *
 * @version   Release: 0.4.3_2016-05
 *
 * @link      https://github.com/windowsazure/azure-sdk-for-php
 */
class GetServicePropertiesResultTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @covers WindowsAzure\Common\Models\GetServicePropertiesResult::create
     */
    public function testCreate()
    {
        // Test
        $result = GetServicePropertiesResult::create(TestResources::getServicePropertiesSample());

        // Assert
        $this->assertTrue(isset($result));
    }

    /**
     * @covers WindowsAzure\Common\Models\GetServicePropertiesResult::getValue
     */
    public function testGetValue()
    {
        // Setup
        $result = GetServicePropertiesResult::create(TestResources::getServicePropertiesSample());
        $expected = ServiceProperties::create(TestResources::getServicePropertiesSample());

        // Test
        $actual = $result->getValue();

        // Assert
        $this->assertEquals($expected, $actual);
    }

    /**
     * @covers WindowsAzure\Common\Models\GetServicePropertiesResult::setValue
     */
    public function testSetValue()
    {
        // Setup
        $result = new GetServicePropertiesResult();
        $expected = ServiceProperties::create(TestResources::getServicePropertiesSample());

        // Test
        $result->setValue($expected);

        // Assert
        $this->assertEquals($expected, $result->getValue());
    }
}


text:
/*
* @Author: Sze Ka Wai Raymond (FakeC)
* @Date:   2016-01-01 03:05:37
* @Last Modified by:   Sze Ka Wai Raymond (FakeC)
* @Last Modified time: 2016-01-24 03:12:45
*/

import Mongoose from 'mongoose';
import Promise from 'bluebird';
import bcrypt from 'bcrypt';
Mongoose.Promise = Promise;

const schema = new Mongoose.Schema({
	username: {
		type: String,
		required: true
	},
	email: {
		type: String,
		required: true,
		index: {
			unique: true
		}
	},
	password: {
		type: String,
		required: true
	},
	role: {
		type: String,
		required: true,
		default: 'USER'
	}
}, {timestamps: true, versionKey: false});

// After validate hook
schema.post('validate', (doc) => {
	// encrypt the password
	doc.password = bcrypt.hashSync(doc.password, 10);
});

// Remove the password information when toObject()
schema.options.toObject = {
	transform: function (doc, ret) {
		delete ret.password;
	}
};

export default Mongoose.model('User', schema, 'Users');