text:
#ifndef KEEPASSX_MESSAGEBOX_H
#define KEEPASSX_MESSAGEBOX_H

#include <QMessageBox>

class MessageBox
{
public:
    static QMessageBox::StandardButton critical(QWidget* parent,
                                                const QString& title, const QString& text,
                                                QMessageBox::StandardButtons buttons = QMessageBox::Ok,
                                                QMessageBox::StandardButton defaultButton = QMessageBox::NoButton);
    static QMessageBox::StandardButton information(QWidget* parent,
                                                   const QString& title, const QString& text,
                                                   QMessageBox::StandardButtons buttons = QMessageBox::Ok,
                                                   QMessageBox::StandardButton defaultButton = QMessageBox::NoButton);
    static QMessageBox::StandardButton question(QWidget* parent,
                                                const QString& title, const QString& text,
                                                QMessageBox::StandardButtons buttons = QMessageBox::Ok,
                                                QMessageBox::StandardButton defaultButton = QMessageBox::NoButton);
    static QMessageBox::StandardButton warning(QWidget* parent,
                                               const QString& title, const QString& text,
                                               QMessageBox::StandardButtons buttons = QMessageBox::Ok,
                                               QMessageBox::StandardButton defaultButton = QMessageBox::NoButton);

    static void setNextAnswer(QMessageBox::StandardButton button);

private:
    static QMessageBox::StandardButton m_nextAnswer;
};

#endif // KEEPASSX_MESSAGEBOX_H


text:
<?php
/**
 * Sensor data push script
 * Handles all the incoming data from various sensors
 *
 * function examples
 * push.php?sid=0&auth=
 */
if(isset($_GET['sid']) && isset($_GET['auth']) && isset($_GET['val']))
{
    include_once('config.php');
    include_once('dbfunctions.php');
    $conn = OrclConnect();

    $sid  = $_GET['sid'];
    $auth = $_GET['auth'];
    $val = $_GET['val'];

    $token = GetAuthToken($conn,$sid);

    if ($auth == $token) {
        echo "Auth Succeed: ";
        echo InsertData($conn, $sid, $val);
    } else {
        echo "Auth Failed";
    }

}

redpajama_set_name: RedPajamaGithub


text:
package temportalist.esotericraft.api.emulation.ability;

import net.minecraft.nbt.NBTTagByte;
import temportalist.esotericraft.api.emulation.IAbility;

/**
 * Created by TheTemportalist on 5/18/2016.
 *
 * @author TheTemportalist
 */
public interface IAbilityFloat extends IAbility<NBTTagByte> {}


text:
package org.springframework.web.servlet.resource;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.junit.Before;
import org.junit.Test;

import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;

import static org.junit.Assert.*;
import static org.mockito.BDDMockito.*;

/**
 * Unit tests for {@link VersionResourceResolver}
 *
 * @author Brian Clozel
 * @author Sam Brannen
 */
public class VersionResourceResolverTests {

	private List<Resource> locations;

	private VersionResourceResolver resolver;

	private ResourceResolverChain chain;

	private VersionStrategy versionStrategy;

	@Before
	public void setup() {
		this.locations = new ArrayList<>();
		this.locations.add(new ClassPathResource("test/", getClass()));
		this.locations.add(new ClassPathResource("testalternatepath/", getClass()));

		this.resolver = new VersionResourceResolver();
		this.chain = mock(ResourceResolverChain.class);
		this.versionStrategy = mock(VersionStrategy.class);
	}

	@Test
	public void resolveResourceExisting() throws Exception {
		String file = "bar.css";
		Resource expected = new ClassPathResource("test/" + file, getClass());
		given(this.chain.resolveResource(null, file, this.locations)).willReturn(expected);

		this.resolver.setStrategyMap(Collections.singletonMap("/**", this.versionStrategy));
		Resource actual = this.resolver.resolveResourceInternal(null, file, this.locations, this.chain);
		assertEquals(expected, actual);
		verify(this.chain, times(1)).resolveResource(null, file, this.locations);
		verify(this.versionStrategy, never()).extractVersion(file);
	}

	@Test
	public void resolveResourceNoVersionStrategy() throws Exception {
		String file = "missing.css";
		given(this.chain.resolveResource(null, file, this.locations)).willReturn(null);

		this.resolver.setStrategyMap(Collections.emptyMap());
		Resource actual = this.resolver.resolveResourceInternal(null, file, this.locations, this.chain);
		assertNull(actual);
		verify(this.chain, times(1)).resolveResource(null, file, this.locations);
	}

	@Test
	public void resolveResourceNoVersionInPath() throws Exception {
		String file = "bar.css";
		given(this.chain.resolveResource(null, file, this.locations)).willReturn(null);
		given(this.versionStrategy.extractVersion(file)).willReturn("");

		this.resolver.setStrategyMap(Collections.singletonMap("/**", this.versionStrategy));
		Resource actual = this.resolver.resolveResourceInternal(null, file, this.locations, this.chain);
		assertNull(actual);
		verify(this.chain, times(1)).resolveResource(null, file, this.locations);
		verify(this.versionStrategy, times(1)).extractVersion(file);
	}

	@Test
	public void resolveResourceNoResourceAfterVersionRemoved() throws Exception {
		String versionFile = "bar-version.css";
		String version = "version";
		String file = "bar.css";
		given(this.chain.resolveResource(null, versionFile, this.locations)).willReturn(null);
		given(this.chain.resolveResource(null, file, this.locations)).willReturn(null);
		given(this.versionStrategy.extractVersion(versionFile)).willReturn(version);
		given(this.versionStrategy.removeVersion(versionFile, version)).willReturn(file);

		this.resolver.setStrategyMap(Collections.singletonMap("/**", this.versionStrategy));
		Resource actual = this.resolver.resolveResourceInternal(null, versionFile, this.locations, this.chain);
		assertNull(actual);
		verify(this.versionStrategy, times(1)).removeVersion(versionFile, version);
	}

	@Test
	public void resolveResourceVersionDoesNotMatch() throws Exception {
		String versionFile = "bar-version.css";
		String version = "version";
		String file = "bar.css";
		Resource expected = new ClassPathResource("test/" + file, getClass());
		given(this.chain.resolveResource(null, versionFile, this.locations)).willReturn(null);
		given(this.chain.resolveResource(null, file, this.locations)).willReturn(expected);
		given(this.versionStrategy.extractVersion(versionFile)).willReturn(version);
		given(this.versionStrategy.removeVersion(versionFile, version)).willReturn(file);
		given(this.versionStrategy.getResourceVersion(expected)).willReturn("newer-version");

		this.resolver.setStrategyMap(Collections.singletonMap("/**", this.versionStrategy));
		Resource actual = this.resolver.resolveResourceInternal(null, versionFile, this.locations, this.chain);
		assertNull(actual);
		verify(this.versionStrategy, times(1)).getResourceVersion(expected);
	}

	@Test
	public void resolveResourceSuccess() throws Exception {
		String versionFile = "bar-version.css";
		String version = "version";
		String file = "bar.css";
		Resource expected = new ClassPathResource("test/" + file, getClass());
		given(this.chain.resolveResource(null, versionFile, this.locations)).willReturn(null);
		given(this.chain.resolveResource(null, file, this.locations)).willReturn(expected);
		given(this.versionStrategy.extractVersion(versionFile)).willReturn(version);
		given(this.versionStrategy.removeVersion(versionFile, version)).willReturn(file);
		given(this.versionStrategy.getResourceVersion(expected)).willReturn(version);

		this.resolver
				.setStrategyMap(Collections.singletonMap("/**", this.versionStrategy));
		Resource actual = this.resolver.resolveResourceInternal(null, versionFile, this.locations, this.chain);
		assertEquals(expected, actual);
		verify(this.versionStrategy, times(1)).getResourceVersion(expected);
	}

	@Test
	public void getStrategyForPath() throws Exception {
		Map<String, VersionStrategy> strategies = new HashMap<>();
		VersionStrategy jsStrategy = mock(VersionStrategy.class);
		VersionStrategy catchAllStrategy = mock(VersionStrategy.class);
		strategies.put("/**", catchAllStrategy);
		strategies.put("/**/*.js", jsStrategy);
		this.resolver.setStrategyMap(strategies);

		assertEquals(catchAllStrategy, this.resolver.getStrategyForPath("foo.css"));
		assertEquals(catchAllStrategy, this.resolver.getStrategyForPath("foo-js.css"));
		assertEquals(jsStrategy, this.resolver.getStrategyForPath("foo.js"));
		assertEquals(jsStrategy, this.resolver.getStrategyForPath("bar/foo.js"));
	}

}


text:
namespace HipchatApiV2.Enums
{
    public enum RoomPrivacy
    {
        Public,
        Private
    }
}


text:
import React from 'react'
import Root from '../components/root'

export default class ViewRenderer {
  render() {
    React.render(<Root/>, document.body);
  }
}


text:
using Nethereum.ABI.FunctionEncoding.Attributes;
using Nethereum.Contracts;
using Nethereum.Contracts.Extensions;
using Nethereum.Web3.Accounts;
using System;
using System.Numerics;
using System.Threading.Tasks;
using Nethereum.Hex.HexTypes;
using Nethereum.JsonRpc.Client;
using Nethereum.RPC.Eth.DTOs;
using Nethereum.Signer;
using Xunit;

namespace Nethereum.Ledger.IntegrationTests
{
    public class AccountSigningTest
    {
        [Function("transfer", "bool")]
        public class TransferFunctionBase : FunctionMessage
        {
            [Parameter("address", "_to", 1)]
            public string To { get; set; }
            [Parameter("uint256", "_value", 2)]
            public BigInteger Value { get; set; }
        }

        public partial class TransferFunction : TransferFunctionBase
        {

        }

        /* margin
        multiply
        license
        alien
        close
        rain
        master
        violin
        cheese
        bonus
        soccer
        museum
        eight
        roof
        defy
        ghost
        venue
        obey
        twelve
        another
        tattoo
        inflict
        sting
        glue

        //legacy
        m/44'/60'/0'/0
        0x1996a57077877D38e18A1BE44A55100D77b8fA1D
        0x128c6818917d98a3b933de1d400e777963424ce71f0a58755b092d1b670394eb

        //standard
        m/44'/60'/0'/0/0
        0x76579b7aD091747F9aF144C207e640136c47A6b8
        0x105023ddd0e214d9e79bd94639a896e5ef19d24e9cb9fe59baf12969ffe0101e
        */

        [Fact]
        public async Task TestSignatureLegacy()
        {
            var addressFrom = "0x1996a57077877D38e18A1BE44A55100D77b8fA1D";
            var privateKey = "0x128c6818917d98a3b933de1d400e777963424ce71f0a58755b092d1b670394eb";

            await Test(addressFrom, privateKey, true).ConfigureAwait(false);
        }

        public async Task Test(string addressFrom, string privateKey, bool legacy)
        {
            var transfer = new TransferFunction();
            transfer.To = "0x12890d2cce102216644c59daE5baed380d848301";
            transfer.FromAddress = addressFrom;
            transfer.Value = 1;
            transfer.Nonce = 1;
            transfer.GasPrice = 100;
            transfer.Gas = 1000;
            var rpcClient = new RpcClient(new Uri("http://localhost:8545"));
            var transactionInput = transfer.CreateTransactionInput("0x12890d2cce102216644c59daE5baed380d84830c");

            var account = new Account(privateKey, Chain.MainNet);

            account.TransactionManager.Client = rpcClient;
            var signature = await account.TransactionManager.SignTransactionAsync(transactionInput).ConfigureAwait(false);

            var ledgerManager = await LedgerFactory.GetWindowsConnectedLedgerManagerAsync().ConfigureAwait(false);
            var externalAccount = new ExternalAccount(new LedgerExternalSigner(ledgerManager, 0, legacy), 1);
            await externalAccount.InitialiseAsync().ConfigureAwait(false);
            externalAccount.InitialiseDefaultTransactionManager(rpcClient);
            //Ensure contract data is enable in the settings of ledger nano
            var signature2 = await externalAccount.TransactionManager.SignTransactionAsync(transactionInput).ConfigureAwait(false);

            Assert.Equal(signature, signature2);

            //Signing just transfer
            var signature3 = await externalAccount.TransactionManager.SignTransactionAsync(new TransactionInput()
            {
                From = addressFrom,
                GasPrice
                    = new HexBigInteger(LegacyTransaction.DEFAULT_GAS_PRICE),
                Gas = new HexBigInteger(LegacyTransaction.DEFAULT_GAS_LIMIT),
                Nonce = new HexBigInteger(1),
                To = "0x12890d2cce102216644c59daE5baed380d848301",
                Value = new HexBigInteger(100)

            }).ConfigureAwait(false);
        }

        [Fact]
        public async Task TestSignatureStandard()
        {
            var addressFrom = "0x76579b7aD091747F9aF144C207e640136c47A6b8";
            var privateKey = "0x105023ddd0e214d9e79bd94639a896e5ef19d24e9cb9fe59baf12969ffe0101e";

            await Test(addressFrom, privateKey, false).ConfigureAwait(false);

        }
    }
}


text:
from random import choice

class Game:
    '''
    Contains all the logic for the 2048 game.
    '''
    def __init__(self, size=4):
        self.size = size

        self.grid = [0]*size*size
        self.rows = [slice(i*size, (i+1)*size) for i in range(size)]
        self.cols = [slice(i, size**2, size) for i in range(size)]

        self.add_tile()
        self.add_tile()

    def __repr__(self):
        ''' Print the board out as a size-by-size grid '''
        rows = []
        for s in self.rows:
            rows.append("\t".join([str(i) for i in self.grid[s]]))
        return "\n".join(rows)

    @property
    def finished(self):
        ''' Is True when 2048 appears on the board, False otherwise. '''
        return self.grid.count(2048) > 0

    @property
    def solvable(self):
        ''' Is True when gameplay can continue, False otherwise. '''
        if self.grid.count(0) > 0:
            return True

        for i in range(self.size**2):
            if (i != self.size**2-1 and self.grid[i] == self.grid[i+1] or
                    i != 0 and self.grid[i] == self.grid[i-1] or
                    i < self.size**2-self.size and self.grid[i] == self.grid[i+self.size] or
                    i > self.size and self.grid[i] == self.grid[i-self.size]):
                return True

        return False

    def add_tile(self):
        ''' Attempt to add a tile to the board '''
        zeros = zip(*filter(lambda (i,v): v==0, enumerate(self.grid)))[0]
        if zeros: self.grid[choice(zeros)] = 2

    def move(self, slices, sort, join_range, step):
        ''' Move the numbers in a certain direction '''
        grid = self.grid[:]
        for s in slices:
            # Move 0's out of the way
            grid[s] = sorted(grid[s], key=sort)

            # Join tiles
            for j in join_range:
                if grid[s][j] and grid[s][j] == grid[s][j+step]:
                    grid[s] = map(lambda (i,v): (i!=j)*v + (i==(j+step))*v, enumerate(grid[s]))
                    break  # only join one tile per slice

            # Move 0's out of the way
            grid[s] = sorted(grid[s], key=sort)

        if grid != self.grid:
            # Grid was changed
            self.grid = grid
            return True
        # Grid was unchanged
        return False

    def move_up(self):
        return self.move(self.cols, lambda i: not bool(i), range(self.size)[-1:0:-1], -1)

    def move_down(self):
        return self.move(self.cols, lambda i: bool(i), range(self.size-1), 1)

    def move_left(self):
        return self.move(self.rows, lambda i: not bool(i), range(self.size)[-1:0:-1], -1)

    def move_right(self):
        return self.move(self.rows, lambda i: bool(i), range(self.size-1), 1)


text:
/*
 * ARClient.h
 *
 *  Created on: Dec 6, 2011
 *      Author: ddaeschler
 */

#ifndef ARCLIENT_H_
#define ARCLIENT_H_

#include "ARTypes.h"
#include "IDecoder.h"
#include "portaudio.h"

#include <boost/asio.hpp>
#include <boost/asio/ip/udp.hpp>
#include <boost/thread.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/circular_buffer.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>

#include <vector>

namespace audioreflector
{
	class ARClient
	{
	private:
		static const char* SubscribeMsg;
		static const char* UnsubscribeMsg;
		static const char* RenewMsg;
		static const int SUBSCRIPTION_RENEWAL_INTERVAL;

		std::string _host;
		ar_ushort _port;
		int _sampleRate;
		IDecoderPtr _decoder;

		boost::asio::io_service _ioService;
		boost::asio::ip::udp::socket _socket;
		boost::asio::ip::udp::endpoint _remoteEndpoint;
		boost::asio::ip::udp::endpoint _rcvEp;

		boost::asio::deadline_timer _subscriptionRenewalTimer;

		PaStream* _outputStream;

		boost::shared_ptr<boost::thread> _networkThread;
		boost::shared_array<char> _packetBuffer;

		boost::circular_buffer<char> _netBuffer;
		boost::mutex _bufferLock;

		bool _pausedForBufferRefill;
		bool _doStop;

		boost::posix_time::ptime _lastBufferDisplay;

		std::vector<char> _builderBuffer;
		int _currentBuildSize;

	public:
		ARClient(const std::string& host, ar_ushort port, int sampleRate,
				IDecoderPtr decoder);
		virtual ~ARClient();

		void start();
		void stop();

	private:
		static int PaCallback(const void *inputBuffer, void *outputBuffer,
		                unsigned long framesPerBuffer,
		                const PaStreamCallbackTimeInfo* timeInfo,
		                PaStreamCallbackFlags statusFlags,
		                void *userData);

		int paCallbackMethod(const void *inputBuffer, void *outputBuffer,
				unsigned long framesPerBuffer,
				const PaStreamCallbackTimeInfo* timeInfo,
				PaStreamCallbackFlags statusFlags);

		void subscribeToServerStream();
		void unsubscribeToServerStream();
		void handleSend(const boost::system::error_code& error, std::size_t bytes_transferred);
		void beginRecv();
		void handleReceive(const boost::system::error_code& error, std::size_t bytes_transferred);

		void initPortaudio();
		void asioThreadRun();
		void resetSubscriptionRenewalTimer();
		void onRenewSubscription(const boost::system::error_code& error);
	};
}

#endif /* ARCLIENT_H_ */


text:
package cpatel1.fuelapp;

import android.test.ActivityInstrumentationTestCase2;

/**
 * Created by chaitali on 16-01-30.
 */
public class FuelListTest extends ActivityInstrumentationTestCase2{

    public FuelListTest() {
        super(FuelTrackActivity.class);
    }

    public void testAddFill(){
        FuelList fills = new FuelList();
        FillUp fill = new LogItem("2016-11-11", "costco", "regular", 500, 20, 10, 50);

        if(fills.hasFill(fill))
            throw new IllegalArgumentException("You already logged this entry");

        fills.add(fill);
        assertTrue(fills.hasFill(fill));

    }

    public void testHasFill(){
        FuelList fills = new FuelList();
        FillUp fill = new LogItem("2016-12-11", "Walmart", "extra", 8000, 30, 15, 50);

        assertFalse(fills.hasFill(fill));
        fills.add(fill);
        assertTrue(fills.hasFill(fill));

    }

    public void testGetFill(){
        FuelList fills = new FuelList();
        FillUp fill = new LogItem("2016-12-11", "Walmart", "extra", 8000, 30, 15, 50);

        fills.add(fill);
        FillUp returnedTweet = fills.getFill(0);

        assertEquals(returnedTweet.getStation(), fill.getStation());
        assertEquals(returnedTweet.getDate(), fill.getDate());
        assertEquals(returnedTweet.getGrade(), fill.getGrade());
        assertEquals(returnedTweet.getOdometer(), fill.getOdometer());
        assertEquals(returnedTweet.getCost(), fill.getCost());
        assertEquals(returnedTweet.getAmount(), fill.getAmount());
        assertEquals(returnedTweet.getUnit(), fill.getUnit());
    }

    public void testGetTweets(){
        FuelList fills = new FuelList();
        FillUp fill = new LogItem("2016-12-11", "Walmart", "extra", 8000, 30, 15, 50);
        FillUp fill1 = new LogItem("2012-11-11", "costco", "regular", 500, 20, 10, 50);

        fills.add(fill);
        fills.add(fill1);

        assertEquals(fills.getFills(), fills.getFills());
    }

    public void testGetCount(){
        FuelList fills = new FuelList();
        FillUp fill = new LogItem ("2010-11-11", "costco", "regular", 500, 20, 10, 50);
        FillUp fill1 = new LogItem("2026-3-7", "Esso", "Diesel", 30000, 90, 45, 50);

        assertEquals(0, fills.getCount());

        fills.add(fill);
        fills.add(fill1);

        assertEquals(2,fills.getCount());
    }

    public void testDeleteTweet(){
        FuelList fills = new FuelList();
        FillUp fill = new LogItem("2010-11-11", "costco", "regular", 500, 20, 10, 50);

        fills.add(fill);
        fills.delete(fill);
        assertFalse(fills.hasFill(fill));
    }

}


text:
namespace DLaB.Xrm.Entities
{

	[System.Runtime.Serialization.DataContractAttribute()]
	[System.CodeDom.Compiler.GeneratedCodeAttribute("CrmSvcUtil", "8.0.1.7297")]
	public enum WorkflowDependency_Type
	{

		[System.Runtime.Serialization.EnumMemberAttribute()]
		ArgumentEntitythatworkflowdependson = 9,

		[System.Runtime.Serialization.EnumMemberAttribute()]
		Attributedefinitionthatworkflowdependson = 8,

		[System.Runtime.Serialization.EnumMemberAttribute()]
		Customentitydefinitionthatworkflowdependson = 7,

		[System.Runtime.Serialization.EnumMemberAttribute()]
		Localparameter = 2,

		[System.Runtime.Serialization.EnumMemberAttribute()]
		Primaryentity = 3,

		[System.Runtime.Serialization.EnumMemberAttribute()]
		PrimaryentityafterSDKoperation = 5,

		[System.Runtime.Serialization.EnumMemberAttribute()]
		PrimaryentitybeforeSDKoperation = 4,

		[System.Runtime.Serialization.EnumMemberAttribute()]
		Relatedentity = 6,

		[System.Runtime.Serialization.EnumMemberAttribute()]
		Sdkassociation = 1,
	}
}


text:
package rkr.simplekeyboard.inputmethod.latin.utils;

import android.content.res.Resources;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;

import rkr.simplekeyboard.inputmethod.R;
import rkr.simplekeyboard.inputmethod.latin.Subtype;
import rkr.simplekeyboard.inputmethod.latin.common.LocaleUtils;

/**
 * Utility methods for building subtypes for the supported locales.
 */
public final class SubtypeLocaleUtils {

    private SubtypeLocaleUtils() {
        // This utility class is not publicly instantiable.
    }

    private static final String LOCALE_AFRIKAANS = "af";
    private static final String LOCALE_ARABIC = "ar";
    private static final String LOCALE_AZERBAIJANI_AZERBAIJAN = "az_AZ";
    private static final String LOCALE_BELARUSIAN_BELARUS = "be_BY";
    private static final String LOCALE_BULGARIAN = "bg";
    private static final String LOCALE_BENGALI_BANGLADESH = "bn_BD";
    private static final String LOCALE_BENGALI_INDIA = "bn_IN";
    private static final String LOCALE_CATALAN = "ca";
    private static final String LOCALE_CZECH = "cs";
    private static final String LOCALE_DANISH = "da";
    private static final String LOCALE_GERMAN = "de";
    private static final String LOCALE_GERMAN_SWITZERLAND = "de_CH";
    private static final String LOCALE_GREEK = "el";
    private static final String LOCALE_ENGLISH_INDIA = "en_IN";
    private static final String LOCALE_ENGLISH_GREAT_BRITAIN = "en_GB";
    private static final String LOCALE_ENGLISH_UNITED_STATES = "en_US";
    private static final String LOCALE_ESPERANTO = "eo";
    private static final String LOCALE_SPANISH = "es";
    private static final String LOCALE_SPANISH_UNITED_STATES = "es_US";
    private static final String LOCALE_SPANISH_LATIN_AMERICA = "es_419";
    private static final String LOCALE_ESTONIAN_ESTONIA = "et_EE";
    private static final String LOCALE_BASQUE_SPAIN = "eu_ES";
    private static final String LOCALE_PERSIAN = "fa";
    private static final String LOCALE_FINNISH = "fi";
    private static final String LOCALE_FRENCH = "fr";
    private static final String LOCALE_FRENCH_CANADA = "fr_CA";
    private static final String LOCALE_FRENCH_SWITZERLAND = "fr_CH";
    private static final String LOCALE_GALICIAN_SPAIN = "gl_ES";
    private static final String LOCALE_HINDI = "hi";
    private static final String LOCALE_CROATIAN = "hr";
    private static final String LOCALE_HUNGARIAN = "hu";
    private static final String LOCALE_ARMENIAN_ARMENIA = "hy_AM";
    // Java uses the deprecated "in" code instead of the standard "id" code for Indonesian.
    private static final String LOCALE_INDONESIAN = "in";
    private static final String LOCALE_ICELANDIC = "is";
    private static final String LOCALE_ITALIAN = "it";
    private static final String LOCALE_ITALIAN_SWITZERLAND = "it_CH";
    // Java uses the deprecated "iw" code instead of the standard "he" code for Hebrew.
    private static final String LOCALE_HEBREW = "iw";
    private static final String LOCALE_GEORGIAN_GEORGIA = "ka_GE";
    private static final String LOCALE_KAZAKH = "kk";
    private static final String LOCALE_KHMER_CAMBODIA = "km_KH";
    private static final String LOCALE_KANNADA_INDIA = "kn_IN";
    private static final String LOCALE_KYRGYZ = "ky";
    private static final String LOCALE_LAO_LAOS = "lo_LA";
    private static final String LOCALE_LITHUANIAN = "lt";
    private static final String LOCALE_LATVIAN = "lv";
    private static final String LOCALE_MACEDONIAN = "mk";
    private static final String LOCALE_MALAYALAM_INDIA = "ml_IN";
    private static final String LOCALE_MONGOLIAN_MONGOLIA = "mn_MN";
    private static final String LOCALE_MARATHI_INDIA = "mr_IN";
    private static final String LOCALE_MALAY_MALAYSIA = "ms_MY";
    private static final String LOCALE_NORWEGIAN_BOKMAL = "nb"; // Norwegian Bokmål
    private static final String LOCALE_NEPALI_NEPAL = "ne_NP";
    private static final String LOCALE_DUTCH = "nl";
    private static final String LOCALE_DUTCH_BELGIUM = "nl_BE";
    private static final String LOCALE_POLISH = "pl";
    private static final String LOCALE_PORTUGUESE_BRAZIL = "pt_BR";
    private static final String LOCALE_PORTUGUESE_PORTUGAL = "pt_PT";
    private static final String LOCALE_ROMANIAN = "ro";
    private static final String LOCALE_RUSSIAN = "ru";
    private static final String LOCALE_SLOVAK = "sk";
    private static final String LOCALE_SLOVENIAN = "sl";
    private static final String LOCALE_SERBIAN = "sr";
    private static final String LOCALE_SERBIAN_LATIN = "sr_ZZ";
    private static final String LOCALE_SWEDISH = "sv";
    private static final String LOCALE_SWAHILI = "sw";
    private static final String LOCALE_TAMIL_INDIA = "ta_IN";
    private static final String LOCALE_TAMIL_SINGAPORE = "ta_SG";
    private static final String LOCALE_TELUGU_INDIA = "te_IN";
    private static final String LOCALE_THAI = "th";
    private static final String LOCALE_TAGALOG = "tl";
    private static final String LOCALE_TURKISH = "tr";
    private static final String LOCALE_UKRAINIAN = "uk";
    private static final String LOCALE_URDU = "ur";
    private static final String LOCALE_UZBEK_UZBEKISTAN = "uz_UZ";
    private static final String LOCALE_VIETNAMESE = "vi";
    private static final String LOCALE_ZULU = "zu";

    private static final String[] sSupportedLocales = new String[] {
            LOCALE_ENGLISH_UNITED_STATES,
            LOCALE_ENGLISH_GREAT_BRITAIN,
            LOCALE_AFRIKAANS,
            LOCALE_ARABIC,
            LOCALE_AZERBAIJANI_AZERBAIJAN,
            LOCALE_BELARUSIAN_BELARUS,
            LOCALE_BULGARIAN,
            LOCALE_BENGALI_BANGLADESH,
            LOCALE_BENGALI_INDIA,
            LOCALE_CATALAN,
            LOCALE_CZECH,
            LOCALE_DANISH,
            LOCALE_GERMAN,
            LOCALE_GERMAN_SWITZERLAND,
            LOCALE_GREEK,
            LOCALE_ENGLISH_INDIA,
            LOCALE_ESPERANTO,
            LOCALE_SPANISH,
            LOCALE_SPANISH_UNITED_STATES,
            LOCALE_SPANISH_LATIN_AMERICA,
            LOCALE_ESTONIAN_ESTONIA,
            LOCALE_BASQUE_SPAIN,
            LOCALE_PERSIAN,
            LOCALE_FINNISH,
            LOCALE_FRENCH,
            LOCALE_FRENCH_CANADA,
            LOCALE_FRENCH_SWITZERLAND,
            LOCALE_GALICIAN_SPAIN,
            LOCALE_HINDI,
            LOCALE_CROATIAN,
            LOCALE_HUNGARIAN,
            LOCALE_ARMENIAN_ARMENIA,
            LOCALE_INDONESIAN,
            LOCALE_ICELANDIC,
            LOCALE_ITALIAN,
            LOCALE_ITALIAN_SWITZERLAND,
            LOCALE_HEBREW,
            LOCALE_GEORGIAN_GEORGIA,
            LOCALE_KAZAKH,
            LOCALE_KHMER_CAMBODIA,
            LOCALE_KANNADA_INDIA,
            LOCALE_KYRGYZ,
            LOCALE_LAO_LAOS,
            LOCALE_LITHUANIAN,
            LOCALE_LATVIAN,
            LOCALE_MACEDONIAN,
            LOCALE_MALAYALAM_INDIA,
            LOCALE_MONGOLIAN_MONGOLIA,
            LOCALE_MARATHI_INDIA,
            LOCALE_MALAY_MALAYSIA,
            LOCALE_NORWEGIAN_BOKMAL,
            LOCALE_NEPALI_NEPAL,
            LOCALE_DUTCH,
            LOCALE_DUTCH_BELGIUM,
            LOCALE_POLISH,
            LOCALE_PORTUGUESE_BRAZIL,
            LOCALE_PORTUGUESE_PORTUGAL,
            LOCALE_ROMANIAN,
            LOCALE_RUSSIAN,
            LOCALE_SLOVAK,
            LOCALE_SLOVENIAN,
            LOCALE_SERBIAN,
            LOCALE_SERBIAN_LATIN,
            LOCALE_SWEDISH,
            LOCALE_SWAHILI,
            LOCALE_TAMIL_INDIA,
            LOCALE_TAMIL_SINGAPORE,
            LOCALE_TELUGU_INDIA,
            LOCALE_THAI,
            LOCALE_TAGALOG,
            LOCALE_TURKISH,
            LOCALE_UKRAINIAN,
            LOCALE_URDU,
            LOCALE_UZBEK_UZBEKISTAN,
            LOCALE_VIETNAMESE,
            LOCALE_ZULU
    };

    /**
     * Get a list of all of the currently supported subtype locales.
     * @return a list of subtype strings in the format of "ll_cc_variant" where "ll" is a language
     * code, "cc" is a country code.
     */
    public static List<String> getSupportedLocales() {
        return Arrays.asList(sSupportedLocales);
    }

    public static final String LAYOUT_ARABIC = "arabic";
    public static final String LAYOUT_ARMENIAN_PHONETIC = "armenian_phonetic";
    public static final String LAYOUT_AZERTY = "azerty";
    public static final String LAYOUT_BENGALI = "bengali";
    public static final String LAYOUT_BENGALI_AKKHOR = "bengali_akkhor";
    public static final String LAYOUT_BENGALI_BIJOY = "bengali_bijoy";
    public static final String LAYOUT_BULGARIAN = "bulgarian";
    public static final String LAYOUT_BULGARIAN_BDS = "bulgarian_bds";
    public static final String LAYOUT_EAST_SLAVIC = "east_slavic";
    public static final String LAYOUT_FARSI = "farsi";
    public static final String LAYOUT_GEORGIAN = "georgian";
    public static final String LAYOUT_GREEK = "greek";
    public static final String LAYOUT_HEBREW = "hebrew";
    public static final String LAYOUT_HINDI = "hindi";
    public static final String LAYOUT_HINDI_COMPACT = "hindi_compact";
    public static final String LAYOUT_KANNADA = "kannada";
    public static final String LAYOUT_KHMER = "khmer";
    public static final String LAYOUT_LAO = "lao";
    public static final String LAYOUT_MACEDONIAN = "macedonian";
    public static final String LAYOUT_MALAYALAM = "malayalam";
    public static final String LAYOUT_MARATHI = "marathi";
    public static final String LAYOUT_MONGOLIAN = "mongolian";
    public static final String LAYOUT_NEPALI_ROMANIZED = "nepali_romanized";
    public static final String LAYOUT_NEPALI_TRADITIONAL = "nepali_traditional";
    public static final String LAYOUT_NORDIC = "nordic";
    public static final String LAYOUT_QWERTY = "qwerty";
    public static final String LAYOUT_QWERTZ = "qwertz";
    public static final String LAYOUT_SERBIAN = "serbian";
    public static final String LAYOUT_SERBIAN_QWERTZ = "serbian_qwertz";
    public static final String LAYOUT_SPANISH = "spanish";
    public static final String LAYOUT_SWISS = "swiss";
    public static final String LAYOUT_TAMIL = "tamil";
    public static final String LAYOUT_TELUGU = "telugu";
    public static final String LAYOUT_THAI = "thai";
    public static final String LAYOUT_TURKISH_Q = "turkish_q";
    public static final String LAYOUT_TURKISH_F = "turkish_f";
    public static final String LAYOUT_URDU = "urdu";
    public static final String LAYOUT_UZBEK = "uzbek";

    /**
     * Get a list of all of the supported subtypes for a locale.
     * @param locale the locale string for the subtypes to look up.
     * @param resources the resources to use.
     * @return the list of subtypes for the specified locale.
     */
    public static List<Subtype> getSubtypes(final String locale, final Resources resources) {
        return new SubtypeBuilder(locale, true, resources).getSubtypes();
    }

    /**
     * Get the default subtype for a locale.
     * @param locale the locale string for the subtype to look up.
     * @param resources the resources to use.
     * @return the default subtype for the specified locale or null if the locale isn't supported.
     */
    public static Subtype getDefaultSubtype(final String locale, final Resources resources) {
        final List<Subtype> subtypes = new SubtypeBuilder(locale, true, resources).getSubtypes();
        return subtypes.size() == 0 ? null : subtypes.get(0);
    }

    /**
     * Get a subtype for a specific locale and keyboard layout.
     * @param locale the locale string for the subtype to look up.
     * @param layoutSet the keyboard layout set name for the subtype.
     * @param resources the resources to use.
     * @return the subtype for the specified locale and layout or null if it isn't supported.
     */
    public static Subtype getSubtype(final String locale, final String layoutSet,
                                     final Resources resources) {
        final List<Subtype> subtypes =
                new SubtypeBuilder(locale, layoutSet, resources).getSubtypes();
        return subtypes.size() == 0 ? null : subtypes.get(0);
    }

    /**
     * Get the list subtypes corresponding to the system's languages.
     * @param resources the resources to use.
     * @return the default list of subtypes based on the system's languages.
     */
    public static List<Subtype> getDefaultSubtypes(final Resources resources) {
        final ArrayList<Locale> supportedLocales = new ArrayList<>(sSupportedLocales.length);
        for (final String localeString : sSupportedLocales) {
            supportedLocales.add(LocaleUtils.constructLocaleFromString(localeString));
        }

        final List<Locale> systemLocales = LocaleUtils.getSystemLocales();

        final ArrayList<Subtype> subtypes = new ArrayList<>();
        final HashSet<Locale> addedLocales = new HashSet<>();
        for (final Locale systemLocale : systemLocales) {
            final Locale bestLocale = LocaleUtils.findBestLocale(systemLocale, supportedLocales);
            if (bestLocale != null && !addedLocales.contains(bestLocale)) {
                addedLocales.add(bestLocale);
                final String bestLocaleString = LocaleUtils.getLocaleString(bestLocale);
                subtypes.add(getDefaultSubtype(bestLocaleString, resources));
            }
        }
        if (subtypes.size() == 0) {
            // there needs to be at least one default subtype
            subtypes.add(getSubtypes(LOCALE_ENGLISH_UNITED_STATES, resources).get(0));
        }
        return subtypes;
    }

    /**
     * Utility for building the supported subtype objects. {@link #getSubtypes} sets up the full
     * list of available subtypes for a locale, but not all of the subtypes that it requests always
     * get returned. The parameters passed in the constructor limit what subtypes are actually built
     * and returned. This allows for a central location for indicating what subtypes are available
     * for each locale without always needing to build them all.
     */
    private static class SubtypeBuilder {
        private final Resources mResources;
        private final boolean mAllowMultiple;
        private final String mLocale;
        private final String mExpectedLayoutSet;
        private List<Subtype> mSubtypes;

        /**
         * Builder for single subtype with a specific locale and layout.
         * @param locale the locale string for the subtype to build.
         * @param layoutSet the keyboard layout set name for the subtype.
         * @param resources the resources to use.
         */
        public SubtypeBuilder(final String locale, final String layoutSet,
                              final Resources resources) {
            mLocale = locale;
            mExpectedLayoutSet = layoutSet;
            mAllowMultiple = false;
            mResources = resources;
        }

        /**
         * Builder for one or all subtypes with a specific locale.
         * @param locale the locale string for the subtype to build.
         * @param all true to get all of the subtypes for the locale or false for just the default.
         * @param resources the resources to use.
         */
        public SubtypeBuilder(final String locale, final boolean all, final Resources resources) {
            mLocale = locale;
            mExpectedLayoutSet = null;
            mAllowMultiple = all;
            mResources = resources;
        }

        /**
         * Get the requested subtypes.
         * @return the list of subtypes that were built.
         */
        public List<Subtype> getSubtypes() {
            if (mSubtypes != null) {
                // in case this gets called again for some reason, the subtypes should only be built
                // once
                return mSubtypes;
            }
            mSubtypes = new ArrayList<>();
            // This should call to build all of the available for each supported locale. The private
            // helper functions will handle skipping building the subtypes that weren't requested.
            // The first subtype that is specified to be built here for each locale will be
            // considered the default.
            switch (mLocale) {
                case LOCALE_AFRIKAANS:
                case LOCALE_AZERBAIJANI_AZERBAIJAN:
                case LOCALE_ENGLISH_INDIA:
                case LOCALE_ENGLISH_GREAT_BRITAIN:
                case LOCALE_ENGLISH_UNITED_STATES:
                case LOCALE_FRENCH_CANADA:
                case LOCALE_INDONESIAN:
                case LOCALE_ICELANDIC:
                case LOCALE_ITALIAN:
                case LOCALE_LITHUANIAN:
                case LOCALE_LATVIAN:
                case LOCALE_MALAY_MALAYSIA:
                case LOCALE_DUTCH:
                case LOCALE_POLISH:
                case LOCALE_PORTUGUESE_BRAZIL:
                case LOCALE_PORTUGUESE_PORTUGAL:
                case LOCALE_ROMANIAN:
                case LOCALE_SLOVAK:
                case LOCALE_SWAHILI:
                case LOCALE_VIETNAMESE:
                case LOCALE_ZULU:
                    addLayout(LAYOUT_QWERTY);
                    addGenericLayouts();
                    break;
                case LOCALE_CZECH:
                case LOCALE_GERMAN:
                case LOCALE_CROATIAN:
                case LOCALE_HUNGARIAN:
                case LOCALE_SLOVENIAN:
                    addLayout(LAYOUT_QWERTZ);
                    addGenericLayouts();
                    break;
                case LOCALE_FRENCH:
                case LOCALE_DUTCH_BELGIUM:
                    addLayout(LAYOUT_AZERTY);
                    addGenericLayouts();
                    break;
                case LOCALE_CATALAN:
                case LOCALE_SPANISH:
                case LOCALE_SPANISH_UNITED_STATES:
                case LOCALE_SPANISH_LATIN_AMERICA:
                case LOCALE_BASQUE_SPAIN:
                case LOCALE_GALICIAN_SPAIN:
                case LOCALE_TAGALOG:
                    addLayout(LAYOUT_SPANISH);
                    addGenericLayouts();
                    break;
                case LOCALE_ESPERANTO:
                    addLayout(LAYOUT_SPANISH);
                    break;
                case LOCALE_DANISH:
                case LOCALE_ESTONIAN_ESTONIA:
                case LOCALE_FINNISH:
                case LOCALE_NORWEGIAN_BOKMAL:
                case LOCALE_SWEDISH:
                    addLayout(LAYOUT_NORDIC);
                    addGenericLayouts();
                    break;
                case LOCALE_GERMAN_SWITZERLAND:
                case LOCALE_FRENCH_SWITZERLAND:
                case LOCALE_ITALIAN_SWITZERLAND:
                    addLayout(LAYOUT_SWISS);
                    addGenericLayouts();
                    break;
                case LOCALE_TURKISH:
                    addLayout(LAYOUT_QWERTY);
                    addLayout(LAYOUT_TURKISH_Q, R.string.subtype_q);
                    addLayout(LAYOUT_TURKISH_F, R.string.subtype_f);
                    addGenericLayouts();
                    break;
                case LOCALE_UZBEK_UZBEKISTAN:
                    addLayout(LAYOUT_UZBEK);
                    addGenericLayouts();
                    break;
                case LOCALE_ARABIC:
                    addLayout(LAYOUT_ARABIC);
                    break;
                case LOCALE_BELARUSIAN_BELARUS:
                case LOCALE_KAZAKH:
                case LOCALE_KYRGYZ:
                case LOCALE_RUSSIAN:
                case LOCALE_UKRAINIAN:
                    addLayout(LAYOUT_EAST_SLAVIC);
                    break;
                case LOCALE_BULGARIAN:
                    addLayout(LAYOUT_BULGARIAN);
                    addLayout(LAYOUT_BULGARIAN_BDS, R.string.subtype_bds);
                    break;
                case LOCALE_BENGALI_BANGLADESH:
                    addLayout(LAYOUT_BENGALI_AKKHOR);
                    addLayout(LAYOUT_BENGALI_BIJOY, R.string.subtype_bijoy);
                    break;
                case LOCALE_BENGALI_INDIA:
                    addLayout(LAYOUT_BENGALI);
                    break;
                case LOCALE_GREEK:
                    addLayout(LAYOUT_GREEK);
                    break;
                case LOCALE_PERSIAN:
                    addLayout(LAYOUT_FARSI);
                    break;
                case LOCALE_HINDI:
                    addLayout(LAYOUT_HINDI);
                    addLayout(LAYOUT_HINDI_COMPACT, R.string.subtype_compact);
                    break;
                case LOCALE_ARMENIAN_ARMENIA:
                    addLayout(LAYOUT_ARMENIAN_PHONETIC);
                    break;
                case LOCALE_HEBREW:
                    addLayout(LAYOUT_HEBREW);
                    break;
                case LOCALE_GEORGIAN_GEORGIA:
                    addLayout(LAYOUT_GEORGIAN);
                    break;
                case LOCALE_KHMER_CAMBODIA:
                    addLayout(LAYOUT_KHMER);
                    break;
                case LOCALE_KANNADA_INDIA:
                    addLayout(LAYOUT_KANNADA);
                    break;
                case LOCALE_LAO_LAOS:
                    addLayout(LAYOUT_LAO);
                    break;
                case LOCALE_MACEDONIAN:
                    addLayout(LAYOUT_MACEDONIAN);
                    break;
                case LOCALE_MALAYALAM_INDIA:
                    addLayout(LAYOUT_MALAYALAM);
                    break;
                case LOCALE_MONGOLIAN_MONGOLIA:
                    addLayout(LAYOUT_MONGOLIAN);
                    break;
                case LOCALE_MARATHI_INDIA:
                    addLayout(LAYOUT_MARATHI);
                    break;
                case LOCALE_NEPALI_NEPAL:
                    addLayout(LAYOUT_NEPALI_ROMANIZED);
                    addLayout(LAYOUT_NEPALI_TRADITIONAL, R.string.subtype_traditional);
                    break;
                case LOCALE_SERBIAN:
                    addLayout(LAYOUT_SERBIAN);
                    break;
                case LOCALE_SERBIAN_LATIN:
                    addLayout(LAYOUT_SERBIAN_QWERTZ);
                    addGenericLayouts();
                    break;
                case LOCALE_TAMIL_INDIA:
                case LOCALE_TAMIL_SINGAPORE:
                    addLayout(LAYOUT_TAMIL);
                    break;
                case LOCALE_TELUGU_INDIA:
                    addLayout(LAYOUT_TELUGU);
                    break;
                case LOCALE_THAI:
                    addLayout(LAYOUT_THAI);
                    break;
                case LOCALE_URDU:
                    addLayout(LAYOUT_URDU);
                    break;
            }
            return mSubtypes;
        }

        /**
         * Check if the layout should skip being built based on the request from the constructor.
         * @param keyboardLayoutSet the layout set for the subtype to potentially build.
         * @return whether the subtype should be skipped.
         */
        private boolean shouldSkipLayout(final String keyboardLayoutSet) {
            if (mAllowMultiple) {
                return false;
            }
            if (mSubtypes.size() > 0) {
                return true;
            }
            if (mExpectedLayoutSet != null) {
                return !mExpectedLayoutSet.equals(keyboardLayoutSet);
            }
            return false;
        }

        /**
         * Add a single layout for the locale. This might not actually add the subtype to the list
         * depending on the original request.
         * @param keyboardLayoutSet the keyboard layout set name.
         */
        private void addLayout(final String keyboardLayoutSet) {
            if (shouldSkipLayout(keyboardLayoutSet)) {
                return;
            }

            // if this is a generic layout, use that corresponding layout name
            final String[] predefinedLayouts =
                    mResources.getStringArray(R.array.predefined_layouts);
            final int predefinedLayoutIndex =
                    Arrays.asList(predefinedLayouts).indexOf(keyboardLayoutSet);
            final String layoutNameStr;
            if (predefinedLayoutIndex >= 0) {
                final String[] predefinedLayoutDisplayNames = mResources.getStringArray(
                        R.array.predefined_layout_display_names);
                layoutNameStr = predefinedLayoutDisplayNames[predefinedLayoutIndex];
            } else {
                layoutNameStr = null;
            }

            mSubtypes.add(
                    new Subtype(mLocale, keyboardLayoutSet, layoutNameStr, false, mResources));
        }

        /**
         * Add a single layout for the locale. This might not actually add the subtype to the list
         * depending on the original request.
         * @param keyboardLayoutSet the keyboard layout set name.
         * @param layoutRes the resource ID to use for the display name of the keyboard layout. This
         *                 generally shouldn't include the name of the language.
         */
        private void addLayout(final String keyboardLayoutSet, final int layoutRes) {
            if (shouldSkipLayout(keyboardLayoutSet)) {
                return;
            }
            mSubtypes.add(
                    new Subtype(mLocale, keyboardLayoutSet, layoutRes, true, mResources));
        }

        /**
         * Add the predefined layouts (eg: QWERTY, AZERTY, etc) for the locale. This might not
         * actually add all of the subtypes to the list depending on the original request.
         */
        private void addGenericLayouts() {
            if (mSubtypes.size() > 0 && !mAllowMultiple) {
                return;
            }
            final int initialSize = mSubtypes.size();
            final String[] predefinedKeyboardLayoutSets = mResources.getStringArray(
                    R.array.predefined_layouts);
            final String[] predefinedKeyboardLayoutSetDisplayNames = mResources.getStringArray(
                    R.array.predefined_layout_display_names);
            for (int i = 0; i < predefinedKeyboardLayoutSets.length; i++) {
                final String predefinedLayout = predefinedKeyboardLayoutSets[i];
                if (shouldSkipLayout(predefinedLayout)) {
                    continue;
                }

                boolean alreadyExists = false;
                for (int subtypeIndex = 0; subtypeIndex < initialSize; subtypeIndex++) {
                    final String layoutSet = mSubtypes.get(subtypeIndex).getKeyboardLayoutSet();
                    if (layoutSet.equals(predefinedLayout)) {
                        alreadyExists = true;
                        break;
                    }
                }
                if (alreadyExists) {
                    continue;
                }

                mSubtypes.add(new Subtype(mLocale, predefinedLayout,
                        predefinedKeyboardLayoutSetDisplayNames[i], true, mResources));
            }
        }
    }
}


text:
package ru.job4j.loop;

import org.junit.Test;

import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;

/**
* Class for testing Paint class.
* @author Eugene Lazarev (mailto:helycopternicht@rambler.ru)
* @version $Id$
* @since 0.1
*/
public class PaintTest {
    /**
    * Test pyramid method.
    */
    @Test
    public void whenPiramidWithHeightTwoThenStringWithTwoRows() {
        Paint paint = new Paint();
        String result = paint.piramid(2);
        String expected = String.format(" ^ %s^^^", System.getProperty("line.separator"));
        assertThat(result, is(expected));
    }

    /**
    * Test pyramid method.
    */
    @Test
    public void whenPiramidWithHeightThreeThenStringWithThreeRows() {
       Paint paint = new Paint();
        String result = paint.piramid(3);
        String expected = String.format("  ^  %s ^^^ %s^^^^^",
         System.getProperty("line.separator"), System.getProperty("line.separator"));
        assertThat(result, is(expected));
    }
}


text:
package codingdojo;

import java.util.Comparator;

public class PokerHandComparator implements Comparator<PokerHand>{

	@Override
	public int compare(PokerHand o1, PokerHand o2) {
		// TODO Auto-generated method stub
		return 0;
	}

}


text:
var error = "The alphaEnabled option requires dev channel or newer.";

function testAlphaEnabled(testId, setValue) {
  var createOptions = { frame: 'none' };
  createOptions.alphaEnabled = setValue;

  chrome.app.window.create('index.html',
                           createOptions,
                           chrome.test.callbackFail(error));
}

// All these tests are run in Stable channel with app.window.alpha
// permission set.

chrome.app.runtime.onLaunched.addListener(function() {
  chrome.test.runTests([

    // Window is created with alphaEnabled set to true.
    function testAlphaEnabledStableInitTrue() {
      testAlphaEnabled('testAlphaEnabledStableInitTrue', true);
    },

    // Window is created with alphaEnabled set to false.
    function testAlphaEnabledStableInitFalse() {
      testAlphaEnabled('testAlphaEnabledStableInitFalse', false);
    },

  ]);
});


text:
SYNONYM

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Hyménomycètes (Alençon) 414 (1876)

#### Original name
Agaricus incanus Fr., 1821

### Remarks
null


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

<title>The GNU C Library: Output Modes</title>

<meta name="description" content="The GNU C Library: Output Modes">
<meta name="keywords" content="The GNU C Library: Output Modes">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="Concept-Index.html#Concept-Index" rel="index" title="Concept Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Terminal-Modes.html#Terminal-Modes" rel="up" title="Terminal Modes">
<link href="Control-Modes.html#Control-Modes" rel="next" title="Control Modes">
<link href="Input-Modes.html#Input-Modes" rel="prev" title="Input Modes">

Next: Control Modes, Previous: Input Modes, Up: Terminal Modes   [Contents][Index]

17.4.5 Output Modes

This section describes the terminal flags and fields that control how
output characters are translated and padded for display.  All of these
are contained in the c_oflag member of the struct termios
structure.

The c_oflag member itself is an integer, and you change the flags
and fields using the operators &, |, and ^.  Don’t
try to specify the entire value for c_oflag—instead, change
only specific flags and leave the rest untouched (see Setting Modes).

Macro: tcflag_t OPOST

If this bit is set, output data is processed in some unspecified way so
that it is displayed appropriately on the terminal device.  This
typically includes mapping newline characters ('\n') onto
carriage return and linefeed pairs.

If this bit isn’t set, the characters are transmitted as-is.

The following three bits are effective only if OPOST is set.

Macro: tcflag_t ONLCR

If this bit is set, convert the newline character on output into a pair
of characters, carriage return followed by linefeed.

Macro: tcflag_t OXTABS

If this bit is set, convert tab characters on output into the appropriate
number of spaces to emulate a tab stop every eight columns.  This bit
exists only on BSD systems and GNU/Hurd systems; on
GNU/Linux systems it is available as XTABS.

Macro: tcflag_t ONOEOT

If this bit is set, discard C-d characters (code 004) on
output.  These characters cause many dial-up terminals to disconnect.
This bit exists only on BSD systems and GNU/Hurd systems.


text:
<?php $this->view('partials/head'); ?>

<?php //Initialize models needed for the table
new Machine_model;
new Disk_report_model;
new Reportdata_model;
?>

 …

<?php $this->view('partials/foot'); ?>


text:
var assert = require('assert');
var readcommand = require('../index');

var CommandAutocomplete = require('../lib/autocomplete');
var InOut = require('./util/inout');

describe('Read', function() {

    it('returns a simple single-line command', function(callback) {
        var inout = new InOut();
        readcommand.read({'input': inout.input(), 'output': inout.output()}, function(err, args, str) {
            assert.strictEqual(args.length, 3);
            assert.strictEqual(args[0], 'curl');
            assert.strictEqual(args[1], 'https://www.google.ca');
            assert.strictEqual(args[2], '--insecure');
            assert.strictEqual(str, 'curl https://www.google.ca --insecure');
            return callback();
        });
        inout.write('curl https://www.google.ca --insecure\n');
    });

    it('parses double-quotes with single-quotes properly in a single-line command', function(callback) {
        var inout = new InOut();
        readcommand.read({'input': inout.input(), 'output': inout.output()}, function(err, args, str) {
            assert.strictEqual(args.length, 2);
            assert.strictEqual(args[0], 'with \' single quote');
            assert.strictEqual(args[1], 'with " double quote');
            assert.strictEqual(str, '"with \' single quote" \'with " double quote\'');
            return callback();
        });
        inout.write('"with \' single quote" \'with " double quote\'\n');
    });

    it('reads escaped quotes and back-slashes as verbatim input', function(callback) {
        var inout = new InOut();
        readcommand.read({'input': inout.input(), 'output': inout.output()}, function(err, args, str) {
            assert.strictEqual(args.length, 3);
            assert.strictEqual(args[0], '\'');
            assert.strictEqual(args[1], '"');
            assert.strictEqual(args[2], '\\');
            assert.strictEqual(str, '\\\' \\" \\\\');
            return callback();
        });
        inout.write('\\\' \\" \\\\\n');
    });

    it('spans to new line when newline is escaped', function(callback) {
        var inout = new InOut();

        // Receive first prompt
        inout.once('data', function(data) {
            assert.strictEqual(data.toString(), '> ');

            // Write first line and wait for second prompt
            inout.write('firstline \\\n');
            inout.once('data', function(data) {
                assert.strictEqual(data.toString(), '> ');

                // Write second line. This will invoke the readcommand.read callback and we finish
                // the test there
                inout.write('secondline\n');
            });
        });

        readcommand.read({'input': inout.input(), 'output': inout.output()}, function(err, args, str) {
            assert.strictEqual(args.length, 2);
            assert.strictEqual(args[0], 'firstline');
            assert.strictEqual(args[1], 'secondline');
            return callback();
        });
    });

    it('consumes new line when there is an open double-quote', function(callback) {
        var inout = new InOut();

        // Receive first prompt
        inout.once('data', function(data) {
            assert.strictEqual(data.toString(), '> ');

            // Write first line and wait for second prompt
            inout.write('this line is "constrained by\n');
            inout.once('data', function(data) {
                assert.strictEqual(data.toString(), '> ');

                // Write second line, which still doesn't close, wait for third prompt
                inout.write('a double-\'\n');
                inout.once('data', function(data) {
                    assert.strictEqual(data.toString(), '> ');

                    // Finish the last line. Test will finish in the readcommand.read callback
                    inout.write('and now we finish" it\n');
                });
            });
        });

        readcommand.read({'input': inout.input(), 'output': inout.output()}, function(err, args, str) {
            assert.strictEqual(args.length, 5);
            assert.strictEqual(args[0], 'this');
            assert.strictEqual(args[1], 'line');
            assert.strictEqual(args[2], 'is');
            assert.strictEqual(args[3], 'constrained by\na double-\'\nand now we finish');
            assert.strictEqual(args[4], 'it');
            assert.strictEqual(str, 'this line is "constrained by\na double-\'\nand now we finish" it');
            return callback();
        });
    });

    it('consumes new line when there is an open single-quote', function(callback) {
        var inout = new InOut();

        // Receive first prompt
        inout.once('data', function(data) {
            assert.strictEqual(data.toString(), '> ');

            // Write first line and wait for second prompt
            inout.write('this line is \'constrained by\n');
            inout.once('data', function(data) {
                assert.strictEqual(data.toString(), '> ');

                // Write second line, which still doesn't close, wait for third prompt
                inout.write('a single-\\\'\n');
                inout.once('data', function(data) {
                    assert.strictEqual(data.toString(), '> ');

                    // Finish the last line. Test will finish in the readcommand.read callback
                    inout.write('and now we finish\' it\n');
                });
            });
        });

        readcommand.read({'input': inout.input(), 'output': inout.output()}, function(err, args, str) {
            assert.strictEqual(args.length, 5);
            assert.strictEqual(args[0], 'this');
            assert.strictEqual(args[1], 'line');
            assert.strictEqual(args[2], 'is');
            assert.strictEqual(args[3], 'constrained by\na single-\'\nand now we finish');
            assert.strictEqual(args[4], 'it');
            assert.strictEqual(str, 'this line is \'constrained by\na single-\\\'\nand now we finish\' it');
            return callback();
        });
    });

    it('shows custom prompts', function(callback) {
        var inout = new InOut();

        // Receive first prompt
        inout.once('data', function(data) {
            // Ensure the prompt is the custom "ps1" prompt
            assert.strictEqual(data.toString(), 'ps1');

            // Write first line and wait for second prompt
            inout.write('firstline \\\n');
            inout.once('data', function(data) {
                // Ensure the prompt is the custom "ps2" prompt
                assert.strictEqual(data.toString(), 'ps2');

                // Write second line. This will invoke the readcommand.read callback and we finish
                // the test there
                inout.write('secondline\n');
            });
        });

        readcommand.read({'input': inout.input(), 'output': inout.output(), 'ps1': 'ps1', 'ps2': 'ps2'}, function(err, args, str) {
            assert.strictEqual(args.length, 2);
            assert.strictEqual(args[0], 'firstline');
            assert.strictEqual(args[1], 'secondline');
            return callback();
        });
    });
});

describe('Loop', function() {

    it('reads a series of commands from the input', function(callback) {
        var inout = new InOut();

        var one = false;
        var two = false;
        var three = false;

        // Kick off the first prompt
        inout.once('data', function(data) {
            assert.strictEqual(data.toString(), '> ');
            inout.write('one\n');
        });

        readcommand.loop({'input': inout.input(), 'output': inout.output()}, function(err, args, str, next) {
            // Receive the "one" command
            if (args[0] === 'one') {
                one = true;
                assert.strictEqual(two, false);
                assert.strictEqual(three, false);
                next();

                inout.once('data', function(data) {
                    assert.strictEqual(data.toString(), '> ');
                    inout.write('two\n');
                });
            } else if (args[0] === 'two') {
                two = true;
                assert.strictEqual(one, true);
                assert.strictEqual(three, false);
                next();

                inout.once('data', function(data) {
                    assert.strictEqual(data.toString(), '> ');
                    inout.write('three\n');
                });
            } else if (args[0] === 'three') {
                three = true;
                assert.strictEqual(one, true);
                assert.strictEqual(two, true);
                return callback();
            } else {
                assert.fail();
            }
        });
    });
});

describe('Auto-complete', function() {

    describe('#getAutocompleteArguments', function() {

        it('returns an empty args array with an empty string', function(callback) {
            CommandAutocomplete.getAutocompleteArguments(null, null, function(abort, args) {
                assert.ok(!abort);
                assert.strictEqual(args.length, 0);
                return callback();
            });
        });

        it('aborts when input string ends in an escape sequence', function(callback) {
            CommandAutocomplete.getAutocompleteArguments(null, '\\', function(abort, args) {
                assert.ok(abort);
                return callback();
            });
        });

        it('aborts when input string spans two lines due to escape sequence', function(callback) {
            CommandAutocomplete.getAutocompleteArguments('my args\\\n', 'are', function(abort, args) {
                assert.ok(abort);
                return callback();
            });
        });

        it('aborts when input string spans two lines due to double-quote', function(callback) {
            CommandAutocomplete.getAutocompleteArguments('my "args\n', 'are', function(abort, args) {
                assert.ok(abort);
                return callback();
            });
        });

        it('aborts when input string spans two lines due to single-quote', function(callback) {
            CommandAutocomplete.getAutocompleteArguments('my \'args\n', 'are', function(abort, args) {
                assert.ok(abort);
                return callback();
            });
        });

        it('does not abort when empty argument spans to second line with escape sequence', function(callback) {
            CommandAutocomplete.getAutocompleteArguments('my args \\\n', '', function(abort, args) {
                assert.ok(!abort);
                assert.strictEqual(args.length, 3);
                assert.strictEqual(args[0], 'my');
                assert.strictEqual(args[1], 'args');
                assert.strictEqual(args[2], '');
                return callback();
            });
        });

        it('provides unquoted arguments', function(callback) {
            CommandAutocomplete.getAutocompleteArguments(null, 'my commands are', function(abort, args) {
                assert.ok(!abort);
                assert.strictEqual(args.length, 3);
                assert.strictEqual(args[0], 'my');
                assert.strictEqual(args[1], 'commands');
                assert.strictEqual(args[2], 'are');
                return callback();
            });
        });

        it('provides double-quote arguments that are unclosed at the end', function(callback) {
            CommandAutocomplete.getAutocompleteArguments(null, 'my commands "are so', function(abort, args) {
                assert.ok(!abort);
                assert.strictEqual(args.length, 3);
                assert.strictEqual(args[0], 'my');
                assert.strictEqual(args[1], 'commands');
                assert.strictEqual(args[2], 'are so');
                return callback();
            });
        });

        it('provides single-quote arguments that are unclosed at the end', function(callback) {
            CommandAutocomplete.getAutocompleteArguments(null, 'my commands \'are so', function(abort, args) {
                assert.ok(!abort);
                assert.strictEqual(args.length, 3);
                assert.strictEqual(args[0], 'my');
                assert.strictEqual(args[1], 'commands');
                assert.strictEqual(args[2], 'are so');
                return callback();
            });
        });

        it('provides double-quote arguments that are closed at the end', function(callback) {
            CommandAutocomplete.getAutocompleteArguments(null, 'my commands "are so"', function(abort, args) {
                assert.ok(!abort);
                assert.strictEqual(args.length, 3);
                assert.strictEqual(args[0], 'my');
                assert.strictEqual(args[1], 'commands');
                assert.strictEqual(args[2], 'are so');
                return callback();
            });
        });

        it('provides single-quote arguments that are closed at the end', function(callback) {
            CommandAutocomplete.getAutocompleteArguments(null, 'my commands \'are so\'', function(abort, args) {
                assert.ok(!abort);
                assert.strictEqual(args.length, 3);
                assert.strictEqual(args[0], 'my');
                assert.strictEqual(args[1], 'commands');
                assert.strictEqual(args[2], 'are so');
                return callback();
            });
        });

        it('filters empty arguments except for the last one', function(callback) {
            CommandAutocomplete.getAutocompleteArguments(null, '  my  commands  are  ', function(abort, args) {
                assert.ok(!abort);
                assert.strictEqual(args.length, 4);
                assert.strictEqual(args[0], 'my');
                assert.strictEqual(args[1], 'commands');
                assert.strictEqual(args[2], 'are');
                assert.strictEqual(args[3], '');
                return callback();
            });
        });

        it('does not abort when final argument is fully in buffer due to escape sequence', function(callback) {
            CommandAutocomplete.getAutocompleteArguments('first line wi\\\n', 'th args', function(abort, args) {
                assert.ok(!abort);
                assert.strictEqual(args.length, 4);
                assert.strictEqual(args[0], 'first');
                assert.strictEqual(args[1], 'line');
                assert.strictEqual(args[2], 'with');
                assert.strictEqual(args[3], 'args');
                return callback();
            });
        });

        it('does not abort when final argument is full in buffer due to double-quote', function(callback) {
            CommandAutocomplete.getAutocompleteArguments('first line "wi\n', 'th" args', function(abort, args) {
                assert.ok(!abort);
                assert.strictEqual(args.length, 4);
                assert.strictEqual(args[0], 'first');
                assert.strictEqual(args[1], 'line');
                assert.strictEqual(args[2], 'wi\nth');
                assert.strictEqual(args[3], 'args');
                return callback();
            });
        });

        it('does not abort when final argument is full in buffer due to single-quote', function(callback) {
            CommandAutocomplete.getAutocompleteArguments('first line \'wi\n', 'th\' args', function(abort, args) {
                assert.ok(!abort);
                assert.strictEqual(args.length, 4);
                assert.strictEqual(args[0], 'first');
                assert.strictEqual(args[1], 'line');
                assert.strictEqual(args[2], 'wi\nth');
                assert.strictEqual(args[3], 'args');
                return callback();
            });
        });

        it('does not abort when quoted arguments starts immediately on new line', function(callback) {
            CommandAutocomplete.getAutocompleteArguments('first line \\\n', '"my argument"', function(abort, args) {
                assert.ok(!abort);
                assert.strictEqual(args.length, 3);
                assert.strictEqual(args[0], 'first');
                assert.strictEqual(args[1], 'line');
                assert.strictEqual(args[2], 'my argument');
                return callback();
            });
        });
    });

    describe('#getAutocompleteReplacements', function() {

        it('replaces single line command at very start of line', function(callback) {
            CommandAutocomplete.getAutocompleteReplacements(null, 'my', ['mycommandisbad'], function(replacements, toReplace) {
                assert.strictEqual(replacements.length, 1);
                assert.strictEqual(replacements[0], 'mycommandisbad ');
                assert.strictEqual(toReplace, 'my');
                return callback();
            });
        });

        it('replaces single line command without quotes', function(callback) {
            CommandAutocomplete.getAutocompleteReplacements(null, 'my command is good', ['bad'], function(replacements, toReplace) {
                assert.strictEqual(replacements.length, 1);
                assert.strictEqual(replacements[0], 'bad ');
                assert.strictEqual(toReplace, 'good');
                return callback();
            });
        });

        it('replaces single line command with double-quotes', function(callback) {
            CommandAutocomplete.getAutocompleteReplacements(null, 'my command is "good yes', ['good no'], function(replacements, toReplace) {
                assert.strictEqual(replacements.length, 1);
                assert.strictEqual(replacements[0], '"good no" ');
                assert.strictEqual(toReplace, '"good yes');
                return callback();
            });
        });

        it('replaces single line command with single-quotes', function(callback) {
            CommandAutocomplete.getAutocompleteReplacements(null, 'my command is \'good yes', ['good no'], function(replacements, toReplace) {
                assert.strictEqual(replacements.length, 1);
                assert.strictEqual(replacements[0], '\'good no\' ');
                assert.strictEqual(toReplace, '\'good yes');
                return callback();
            });
        });

        it('replaces escaped multi-line command without quotes', function(callback) {
            CommandAutocomplete.getAutocompleteReplacements('my command i\\\n', 's good', ['bad'], function(replacements, toReplace) {
                assert.strictEqual(replacements.length, 1);
                assert.strictEqual(replacements[0], 'bad ');
                assert.strictEqual(toReplace, 'good');
                return callback();
            });
        });

        it('replaces escaped multi-line commands with double-quotes', function(callback) {
            CommandAutocomplete.getAutocompleteReplacements('my command i\\\n', 's "good yes', ['good no'], function(replacements, toReplace) {
                assert.strictEqual(replacements.length, 1);
                assert.strictEqual(replacements[0], '"good no" ');
                assert.strictEqual(toReplace, '"good yes');
                return callback();
            });
        });

        it('replaces escaped multi-line commands with single-quotes', function(callback) {
            CommandAutocomplete.getAutocompleteReplacements('my command i\\\n', 's \'good yes', ['good no'], function(replacements, toReplace) {
                assert.strictEqual(replacements.length, 1);
                assert.strictEqual(replacements[0], '\'good no\' ');
                assert.strictEqual(toReplace, '\'good yes');
                return callback();
            });
        });

        it('replaces double-quoted multi-line command without quotes', function(callback) {
            CommandAutocomplete.getAutocompleteReplacements('my command "i\n', 's" good', ['bad'], function(replacements, toReplace) {
                assert.strictEqual(replacements.length, 1);
                assert.strictEqual(replacements[0], 'bad ');
                assert.strictEqual(toReplace, 'good');
                return callback();
            });
        });

        it('replaces double-quoted multi-line commands with double-quotes', function(callback) {
            CommandAutocomplete.getAutocompleteReplacements('my command "i\n', 's" "good yes', ['good no'], function(replacements, toReplace) {
                assert.strictEqual(replacements.length, 1);
                assert.strictEqual(replacements[0], '"good no" ');
                assert.strictEqual(toReplace, '"good yes');
                return callback();
            });
        });

        it('replaces double-quoted multi-line commands with single-quotes', function(callback) {
            CommandAutocomplete.getAutocompleteReplacements('my command "i\n', 's" \'good yes', ['good no'], function(replacements, toReplace) {
                assert.strictEqual(replacements.length, 1);
                assert.strictEqual(replacements[0], '\'good no\' ');
                assert.strictEqual(toReplace, '\'good yes');
                return callback();
            });
        });

        it('replaces single-quoted multi-line command without quotes', function(callback) {
            CommandAutocomplete.getAutocompleteReplacements('my command \'i\n', 's\' good', ['bad'], function(replacements, toReplace) {
                assert.strictEqual(replacements.length, 1);
                assert.strictEqual(replacements[0], 'bad ');
                assert.strictEqual(toReplace, 'good');
                return callback();
            });
        });

        it('replaces single-quoted multi-line commands with double-quotes', function(callback) {
            CommandAutocomplete.getAutocompleteReplacements('my command \'i\n', 's\' "good yes', ['good no'], function(replacements, toReplace) {
                assert.strictEqual(replacements.length, 1);
                assert.strictEqual(replacements[0], '"good no" ');
                assert.strictEqual(toReplace, '"good yes');
                return callback();
            });
        });

        it('replaces single-quoted multi-line commands with single-quotes', function(callback) {
            CommandAutocomplete.getAutocompleteReplacements('my command \'i\n', 's\' \'good yes', ['good no'], function(replacements, toReplace) {
                assert.strictEqual(replacements.length, 1);
                assert.strictEqual(replacements[0], '\'good no\' ');
                assert.strictEqual(toReplace, '\'good yes');
                return callback();
            });
        });

        it('replaces multi-line command at very start of line', function(callback) {
            CommandAutocomplete.getAutocompleteReplacements('my command \\\n', 'is', ['isbad'], function(replacements, toReplace) {
                assert.strictEqual(replacements.length, 1);
                assert.strictEqual(replacements[0], 'isbad ');
                assert.strictEqual(toReplace, 'is');
                return callback();
            });
        });

        it('quotes replacements that contain spaces', function(callback) {
            CommandAutocomplete.getAutocompleteReplacements(null, 'my', ['command is bad'], function(replacements, toReplace) {
                assert.strictEqual(replacements.length, 1);
                assert.strictEqual(replacements[0], '"command is bad" ');
                assert.strictEqual(toReplace, 'my');
                return callback();
            });
        });

        it('appends replacements to the command string when command ends with single white-space', function(callback) {
            CommandAutocomplete.getAutocompleteReplacements(null, 'number ', ['123456789'], function(replacements, toReplace) {
                assert.strictEqual(replacements.length, 1);
                assert.strictEqual(replacements[0], '123456789 ');
                assert.strictEqual(toReplace, '');
                return callback();
            });
        });

        it('appends replacements to the command string when command ends with multiple white-space', function(callback) {
            CommandAutocomplete.getAutocompleteReplacements(null, 'number    ', ['123456789'], function(replacements, toReplace) {
                assert.strictEqual(replacements.length, 1);
                assert.strictEqual(replacements[0], '123456789 ');
                assert.strictEqual(toReplace, '');
                return callback();
            });
        });

        it('appends replacements to the command string when command ends with all white-space then a new line', function(callback) {
            CommandAutocomplete.getAutocompleteReplacements('number \\\n', null, ['123456789'], function(replacements, toReplace) {
                assert.strictEqual(replacements.length, 1);
                assert.strictEqual(replacements[0], '123456789 ');
                assert.strictEqual(toReplace, '');
                return callback();
            });
        });

        it('appends replacements to the command string when command ends with all white-space then a new line and more white-space', function(callback) {
            CommandAutocomplete.getAutocompleteReplacements('number \\\n', '  ', ['123456789'], function(replacements, toReplace) {
                assert.strictEqual(replacements.length, 1);
                assert.strictEqual(replacements[0], '123456789 ');
                assert.strictEqual(toReplace, '');
                return callback();
            });
        });
    });
});


text:
class ForwardMailer < ActionMailer::Base
  def slack(options)
    mail options
  end

  def team(options)
    mail options
  end
end


text:
package org.fest.assertions.api;

import static org.fest.assertions.test.IntArrays.emptyArray;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertSame;

import org.junit.Test;

/**
 * Tests for {@link Assertions#assertThat(int[])}.
 *
 * @author Alex Ruiz
 * @author Yvonne Wang
 */
public class Assertions_assertThat_with_IntArray_Test {

  @Test
  public void should_create_Assert() {
    IntArrayAssert assertions = Assertions.assertThat(emptyArray());
    assertNotNull(assertions);
  }

  @Test
  public void should_pass_actual() {
    int[] actual = emptyArray();
    IntArrayAssert assertions = Assertions.assertThat(actual);
    assertSame(actual, assertions.actual);
  }
}


text:
DROP TABLE IF EXISTS department;

CREATE TABLE department (
    id integer,
    name character varying(45),
    create_date timestamp with time zone,
    PRIMARY KEY (id)
);

DROP TABLE IF EXISTS employee;

CREATE TABLE employee (
    id integer,
    name character varying(50),
    age smallint,
    gender character varying(10),
    entry_date timestamp with time zone,
    department_id integer,
    PRIMARY KEY (id)
);


text:
<template name="dragArea">

Drop items here

</template>


text:
namespace clover {
namespace animation {

/// Defines a joint in bvh format
struct BvhJoint {
	enum class Channel {
		PosX,
		PosY,
		PosZ,
		RotX,
		RotY,
		RotZ
	};

	util::Str8 name;
	util::Vec3f offset;
	util::DynArray<Channel> channels;
	util::DynArray<BvhJoint> subJoints;
};

/// Reflects bvh format
struct BvhData {
	BvhJoint rootJoint;
	SizeType frameCount;
	real32 frameTime;
	util::DynArray<real32> samples;
};

BvhData parseBvhAnimation(const util::Str8& data);

util::DynArray<JointDef> jointDefsFromBvh(const BvhData& bvh_data);

/// @return Local poses (not in-bind)
util::DynArray<ArmaturePose::Pose> calcLocalPosesFromBvh(const BvhData& bvh_data, const util::HashMap<util::Str8, JointId>& joint_name_to_id);

} // animation
} // clover

#endif // CLOVER_ANIMATION_BVH_UTIL_HPP


text:
define(['./toInteger', './toNumber', './toString'], function(toInteger, toNumber, toString) {

  /* Built-in method references for those with the same name as other `lodash` methods. */
  var nativeMin = Math.min;

  /**
   * Creates a function like `_.round`.
   *
   * @private
   * @param {string} methodName The name of the `Math` method to use when rounding.
   * @returns {Function} Returns the new round function.
   */
  function createRound(methodName) {
    var func = Math[methodName];
    return function(number, precision) {
      number = toNumber(number);
      precision = nativeMin(toInteger(precision), 292);
      if (precision) {
        // Shift with exponential notation to avoid floating-point issues.
        // See [MDN](https://mdn.io/round#Examples) for more details.
        var pair = (toString(number) + 'e').split('e'),
            value = func(pair[0] + 'e' + (+pair[1] + precision));

        pair = (toString(value) + 'e').split('e');
        return +(pair[0] + 'e' + (+pair[1] - precision));
      }
      return func(number);
    };
  }

  return createRound;
});


text:
import unittest
import django
# in ortder to can run also by unittest without manage.py
django.setup()
from tests.inspectdb.dependent_model.models import Organization  # NOQA must be after setup()

class DependentModelTest(unittest.TestCase):
    def test_dependent_model_can_copy_fields(self):
        self.assertIn('@', Organization.objects.get().created_by.Username)
        Organization.objects.get().address

if __name__ == '__main__':
    unittest.main()


text:
Password Recovery

    <form name="passwordRecoveryForm" novalidate ng-submit="vm.recoverPassword()">

                Username
                <input type="text" id="userName" name="userName" ng-model="vm.recoveryData.userName" required placeholder="Enter your username" />

Username is required.

            <button type="submit">Send</button>

{{vm.message}}

    </form>


text:
package org.lwjgl.openxr;

import javax.annotation.*;

import java.nio.*;

import org.lwjgl.*;
import org.lwjgl.system.*;

import static org.lwjgl.system.MemoryUtil.*;
import static org.lwjgl.system.MemoryStack.*;

/**
 * Scene mesh buffers.
 *
 *
Valid Usage (Implicit)

 *
 *

 *
The {@link MSFTSceneUnderstanding XR_MSFT_scene_understanding} extension must be enabled prior to using {@link XrSceneMeshBuffersMSFT}

 *
{@code type} must be {@link MSFTSceneUnderstanding#XR_TYPE_SCENE_MESH_BUFFERS_MSFT TYPE_SCENE_MESH_BUFFERS_MSFT}

 *
{@code next} must be {@code NULL} or a valid pointer to the next structure in a structure chain

 *

 *
 *
See Also

 *
 *
{@link XrSceneMeshIndicesUint16MSFT}, {@link XrSceneMeshIndicesUint32MSFT}, {@link XrSceneMeshVertexBufferMSFT}, {@link MSFTSceneUnderstanding#xrGetSceneMeshBuffersMSFT GetSceneMeshBuffersMSFT}

 *
 *
Layout

 *
 *

 * struct XrSceneMeshBuffersMSFT {
 *     XrStructureType {@link #type};
 *     void * {@link #next};
 * }

 */
public class XrSceneMeshBuffersMSFT extends Struct implements NativeResource {

    /** The struct size in bytes. */
    public static final int SIZEOF;

    /** The struct alignment in bytes. */
    public static final int ALIGNOF;

    /** The struct member offsets. */
    public static final int
        TYPE,
        NEXT;

    static {
        Layout layout = __struct(
            __member(4),
            __member(POINTER_SIZE)
        );

        SIZEOF = layout.getSize();
        ALIGNOF = layout.getAlignment();

        TYPE = layout.offsetof(0);
        NEXT = layout.offsetof(1);
    }

    /**
     * Creates a {@code XrSceneMeshBuffersMSFT} instance at the current position of the specified {@link ByteBuffer} container. Changes to the buffer's content will be
     * visible to the struct instance and vice versa.
     *
     *
The created instance holds a strong reference to the container object.

     */
    public XrSceneMeshBuffersMSFT(ByteBuffer container) {
        super(memAddress(container), __checkContainer(container, SIZEOF));
    }

    @Override
    public int sizeof() { return SIZEOF; }

    /** the {@code XrStructureType} of this structure. */
    @NativeType("XrStructureType")
    public int type() { return ntype(address()); }
    /** {@code NULL} or a pointer to the next structure in a structure chain. */
    @NativeType("void *")
    public long next() { return nnext(address()); }

    /** Sets the specified value to the {@link #type} field. */
    public XrSceneMeshBuffersMSFT type(@NativeType("XrStructureType") int value) { ntype(address(), value); return this; }
    /** Sets the {@link MSFTSceneUnderstanding#XR_TYPE_SCENE_MESH_BUFFERS_MSFT TYPE_SCENE_MESH_BUFFERS_MSFT} value to the {@link #type} field. */
    public XrSceneMeshBuffersMSFT type$Default() { return type(MSFTSceneUnderstanding.XR_TYPE_SCENE_MESH_BUFFERS_MSFT); }
    /** Sets the specified value to the {@link #next} field. */
    public XrSceneMeshBuffersMSFT next(@NativeType("void *") long value) { nnext(address(), value); return this; }

    /** Initializes this struct with the specified values. */
    public XrSceneMeshBuffersMSFT set(
        int type,
        long next
    ) {
        type(type);
        next(next);

        return this;
    }

    /**
     * Copies the specified struct data to this struct.
     *
     * @param src the source struct
     *
     * @return this struct
     */
    public XrSceneMeshBuffersMSFT set(XrSceneMeshBuffersMSFT src) {
        memCopy(src.address(), address(), SIZEOF);
        return this;
    }

    // -----------------------------------

    /** Returns a new {@code XrSceneMeshBuffersMSFT} instance allocated with {@link MemoryUtil#memAlloc memAlloc}. The instance must be explicitly freed. */
    public static XrSceneMeshBuffersMSFT malloc() {
        return wrap(XrSceneMeshBuffersMSFT.class, nmemAllocChecked(SIZEOF));
    }

    /** Returns a new {@code XrSceneMeshBuffersMSFT} instance allocated with {@link MemoryUtil#memCalloc memCalloc}. The instance must be explicitly freed. */
    public static XrSceneMeshBuffersMSFT calloc() {
        return wrap(XrSceneMeshBuffersMSFT.class, nmemCallocChecked(1, SIZEOF));
    }

    /** Returns a new {@code XrSceneMeshBuffersMSFT} instance allocated with {@link BufferUtils}. */
    public static XrSceneMeshBuffersMSFT create() {
        ByteBuffer container = BufferUtils.createByteBuffer(SIZEOF);
        return wrap(XrSceneMeshBuffersMSFT.class, memAddress(container), container);
    }

    /** Returns a new {@code XrSceneMeshBuffersMSFT} instance for the specified memory address. */
    public static XrSceneMeshBuffersMSFT create(long address) {
        return wrap(XrSceneMeshBuffersMSFT.class, address);
    }

    /** Like {@link #create(long) create}, but returns {@code null} if {@code address} is {@code NULL}. */
    @Nullable
    public static XrSceneMeshBuffersMSFT createSafe(long address) {
        return address == NULL ? null : wrap(XrSceneMeshBuffersMSFT.class, address);
    }

    /**
     * Returns a new {@link XrSceneMeshBuffersMSFT.Buffer} instance allocated with {@link MemoryUtil#memAlloc memAlloc}. The instance must be explicitly freed.
     *
     * @param capacity the buffer capacity
     */
    public static XrSceneMeshBuffersMSFT.Buffer malloc(int capacity) {
        return wrap(Buffer.class, nmemAllocChecked(__checkMalloc(capacity, SIZEOF)), capacity);
    }

    /**
     * Returns a new {@link XrSceneMeshBuffersMSFT.Buffer} instance allocated with {@link MemoryUtil#memCalloc memCalloc}. The instance must be explicitly freed.
     *
     * @param capacity the buffer capacity
     */
    public static XrSceneMeshBuffersMSFT.Buffer calloc(int capacity) {
        return wrap(Buffer.class, nmemCallocChecked(capacity, SIZEOF), capacity);
    }

    /**
     * Returns a new {@link XrSceneMeshBuffersMSFT.Buffer} instance allocated with {@link BufferUtils}.
     *
     * @param capacity the buffer capacity
     */
    public static XrSceneMeshBuffersMSFT.Buffer create(int capacity) {
        ByteBuffer container = __create(capacity, SIZEOF);
        return wrap(Buffer.class, memAddress(container), capacity, container);
    }

    /**
     * Create a {@link XrSceneMeshBuffersMSFT.Buffer} instance at the specified memory.
     *
     * @param address  the memory address
     * @param capacity the buffer capacity
     */
    public static XrSceneMeshBuffersMSFT.Buffer create(long address, int capacity) {
        return wrap(Buffer.class, address, capacity);
    }

    /** Like {@link #create(long, int) create}, but returns {@code null} if {@code address} is {@code NULL}. */
    @Nullable
    public static XrSceneMeshBuffersMSFT.Buffer createSafe(long address, int capacity) {
        return address == NULL ? null : wrap(Buffer.class, address, capacity);
    }

    /**
     * Returns a new {@code XrSceneMeshBuffersMSFT} instance allocated on the specified {@link MemoryStack}.
     *
     * @param stack the stack from which to allocate
     */
    public static XrSceneMeshBuffersMSFT malloc(MemoryStack stack) {
        return wrap(XrSceneMeshBuffersMSFT.class, stack.nmalloc(ALIGNOF, SIZEOF));
    }

    /**
     * Returns a new {@code XrSceneMeshBuffersMSFT} instance allocated on the specified {@link MemoryStack} and initializes all its bits to zero.
     *
     * @param stack the stack from which to allocate
     */
    public static XrSceneMeshBuffersMSFT calloc(MemoryStack stack) {
        return wrap(XrSceneMeshBuffersMSFT.class, stack.ncalloc(ALIGNOF, 1, SIZEOF));
    }

    /**
     * Returns a new {@link XrSceneMeshBuffersMSFT.Buffer} instance allocated on the specified {@link MemoryStack}.
     *
     * @param stack    the stack from which to allocate
     * @param capacity the buffer capacity
     */
    public static XrSceneMeshBuffersMSFT.Buffer malloc(int capacity, MemoryStack stack) {
        return wrap(Buffer.class, stack.nmalloc(ALIGNOF, capacity * SIZEOF), capacity);
    }

    /**
     * Returns a new {@link XrSceneMeshBuffersMSFT.Buffer} instance allocated on the specified {@link MemoryStack} and initializes all its bits to zero.
     *
     * @param stack    the stack from which to allocate
     * @param capacity the buffer capacity
     */
    public static XrSceneMeshBuffersMSFT.Buffer calloc(int capacity, MemoryStack stack) {
        return wrap(Buffer.class, stack.ncalloc(ALIGNOF, capacity, SIZEOF), capacity);
    }

    // -----------------------------------

    /** Unsafe version of {@link #type}. */
    public static int ntype(long struct) { return UNSAFE.getInt(null, struct + XrSceneMeshBuffersMSFT.TYPE); }
    /** Unsafe version of {@link #next}. */
    public static long nnext(long struct) { return memGetAddress(struct + XrSceneMeshBuffersMSFT.NEXT); }

    /** Unsafe version of {@link #type(int) type}. */
    public static void ntype(long struct, int value) { UNSAFE.putInt(null, struct + XrSceneMeshBuffersMSFT.TYPE, value); }
    /** Unsafe version of {@link #next(long) next}. */
    public static void nnext(long struct, long value) { memPutAddress(struct + XrSceneMeshBuffersMSFT.NEXT, value); }

    // -----------------------------------

    /** An array of {@link XrSceneMeshBuffersMSFT} structs. */
    public static class Buffer extends StructBuffer<XrSceneMeshBuffersMSFT, Buffer> implements NativeResource {

        private static final XrSceneMeshBuffersMSFT ELEMENT_FACTORY = XrSceneMeshBuffersMSFT.create(-1L);

        /**
         * Creates a new {@code XrSceneMeshBuffersMSFT.Buffer} instance backed by the specified container.
         *
         * Changes to the container's content will be visible to the struct buffer instance and vice versa. The two buffers' position, limit, and mark values
         * will be independent. The new buffer's position will be zero, its capacity and its limit will be the number of bytes remaining in this buffer divided
         * by {@link XrSceneMeshBuffersMSFT#SIZEOF}, and its mark will be undefined.
         *
         *
The created buffer instance holds a strong reference to the container object.

         */
        public Buffer(ByteBuffer container) {
            super(container, container.remaining() / SIZEOF);
        }

        public Buffer(long address, int cap) {
            super(address, null, -1, 0, cap, cap);
        }

        Buffer(long address, @Nullable ByteBuffer container, int mark, int pos, int lim, int cap) {
            super(address, container, mark, pos, lim, cap);
        }

        @Override
        protected Buffer self() {
            return this;
        }

        @Override
        protected XrSceneMeshBuffersMSFT getElementFactory() {
            return ELEMENT_FACTORY;
        }

        /** @return the value of the {@link XrSceneMeshBuffersMSFT#type} field. */
        @NativeType("XrStructureType")
        public int type() { return XrSceneMeshBuffersMSFT.ntype(address()); }
        /** @return the value of the {@link XrSceneMeshBuffersMSFT#next} field. */
        @NativeType("void *")
        public long next() { return XrSceneMeshBuffersMSFT.nnext(address()); }

        /** Sets the specified value to the {@link XrSceneMeshBuffersMSFT#type} field. */
        public XrSceneMeshBuffersMSFT.Buffer type(@NativeType("XrStructureType") int value) { XrSceneMeshBuffersMSFT.ntype(address(), value); return this; }
        /** Sets the {@link MSFTSceneUnderstanding#XR_TYPE_SCENE_MESH_BUFFERS_MSFT TYPE_SCENE_MESH_BUFFERS_MSFT} value to the {@link XrSceneMeshBuffersMSFT#type} field. */
        public XrSceneMeshBuffersMSFT.Buffer type$Default() { return type(MSFTSceneUnderstanding.XR_TYPE_SCENE_MESH_BUFFERS_MSFT); }
        /** Sets the specified value to the {@link XrSceneMeshBuffersMSFT#next} field. */
        public XrSceneMeshBuffersMSFT.Buffer next(@NativeType("void *") long value) { XrSceneMeshBuffersMSFT.nnext(address(), value); return this; }

    }

}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SDL2;

namespace SimpleSDLWrapperDotNET
{
    public class Timer
    {
        public uint StartTime { get; private set; }
        public uint StopTime { get; private set; }
        public bool isRunning { get; private set; }
        public TimeSpan ElapsedTime
        {
            get
            {
                if (isRunning)
                {
                    return TimeSpan.Zero;
                }
                else
                {
                    return TimeSpan.FromMilliseconds(StopTime - StartTime);
                }
            }
        }

        public Timer()
        {
            isRunning = false;
            StartTime = 0;
        }

        public void Start()
        {
            if (!isRunning)
            {
                StartTime = SDL.SDL_GetTicks();
                isRunning = true;
            }
        }

        public void Stop()
        {
            if(isRunning)
            {
                StopTime = SDL.SDL_GetTicks();
                isRunning = false;
            }
        }
    }
}