text:
<!DOCTYPE html >

          <meta http-equiv="X-UA-Compatible" content="IE=edge" />
          <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
          <title>ScalaTest 3.0.1  - org.scalatest.junit</title>
          <meta name="description" content="ScalaTest 3.0.1 - org.scalatest.junit" />
          <meta name="keywords" content="ScalaTest 3.0.1 org.scalatest.junit" />
          <meta http-equiv="content-type" content="text/html; charset=UTF-8" />

      <link href="../../../lib/index.css" media="screen" type="text/css" rel="stylesheet" />
      <link href="../../../lib/template.css" media="screen" type="text/css" rel="stylesheet" />
      <link href="../../../lib/diagrams.css" media="screen" type="text/css" rel="stylesheet" id="diagrams-css" />

        ScalaTest 3.0.1
        < Back

            <input autocapitalize="none" placeholder="Search" id="index-input" type="text" accesskey="/" />
            
            

Packages

        

        package

              root

Definition Classes

root

        

        package

              org

Definition Classes

root

        

        package

              scalatest

ScalaTest's main traits, classes, and other members, including members supporting ScalaTest's DSL for the Scala interpreter.

ScalaTest's main traits, classes, and other members, including members supporting ScalaTest's DSL for the Scala interpreter.

Definition Classes

org

        

        package

              compatible

Definition Classes

scalatest

        

        package

              concurrent

ScalaTest's main traits, classes, and other members, including members supporting ScalaTest's DSL for the Scala interpreter.

ScalaTest's main traits, classes, and other members, including members supporting ScalaTest's DSL for the Scala interpreter.

Definition Classes

scalatest

        

        package

              easymock

Definition Classes

scalatest

        

        package

              enablers

Definition Classes

scalatest

        

        package

              events

Definition Classes

scalatest

        

        package

              exceptions

Definition Classes

scalatest

        

        package

              fixture

Definition Classes

scalatest

        

        package

              jmock

Definition Classes

scalatest

        

        package

        junit

Definition Classes

scalatest

                          AssertionsForJUnit

                          JUnit3Suite

                          JUnitRunner

                          JUnitSuite

                          JUnitSuiteLike

                          JUnitTestFailedError

                          JUnitWrapperSuite

        

        package

              matchers

Definition Classes

scalatest

        

        package

              mockito

Definition Classes

scalatest

        

        package

              path

Definition Classes

scalatest

        

        package

              prop

Definition Classes

scalatest

        

        package

              refspec

Definition Classes

scalatest

        

        package

              selenium

Definition Classes

scalatest

        

        package

              tagobjects

Definition Classes

scalatest

        

        package

              tags

Definition Classes

scalatest

        

        package

              testng

Definition Classes

scalatest

        

        package

              time

Definition Classes

scalatest

        

        package

              tools

Definition Classes

scalatest

        

        package

              words

Definition Classes

scalatest

p

org.scalatest

junit

        

        package

        junit

          

            <input id="mbrsel-input" placeholder="Filter all members" type="text" accesskey="/" />

          

            Ordering

Alphabetic

              Visibility

Public

All

Type Members

        

        trait

              AssertionsForJUnit
             extends Assertions

Trait that contains ScalaTest's basic assertion methods, suitable for use with JUnit.

Trait that contains ScalaTest's basic assertion methods, suitable for use with JUnit.

The assertion methods provided in this trait look and behave exactly like the ones in
Assertions, except instead of throwing
TestFailedException they throw
JUnitTestFailedError,
which extends junit.framework.AssertionFailedError.

JUnit 3 (release 3.8 and earlier) distinguishes between failures and errors.
If a test fails because of a failed assertion, that is considered a failure. If a test
fails for any other reason, either the test code or the application being tested threw an unexpected
exception, that is considered an error. The way JUnit 3 decides whether an exception represents
a failure or error is that only thrown junit.framework.AssertionFailedErrors are considered
failures. Any other exception type is considered an error. The exception type thrown by the JUnit 3
assertion methods declared in junit.framework.Assert (such as assertEquals,
assertTrue, and fail) is, therefore, AssertionFailedError.

In JUnit 4, AssertionFailedError was made to extend java.lang.AssertionError,
and the distinction between failures and errors was essentially dropped. However, some tools that integrate
with JUnit carry on this distinction, so even if you are using JUnit 4 you may want to use this
AssertionsForJUnit trait instead of plain-old ScalaTest
Assertions.

To use this trait in a JUnit 3 TestCase, you can mix it into your TestCase class, like this:

import junit.framework.TestCase
import org.scalatest.junit.AssertionsForJUnit

class MyTestCase extends TestCase with AssertionsForJUnit {

  def testSomething() {
    assert("hi".charAt(1) === 'i')
  }

  // ...
}

You can alternatively import the methods defined in this trait.

import junit.framework.TestCase
import org.scalatest.junit.AssertionsForJUnit._

class MyTestCase extends TestCase {

  def testSomething() {
    assert("hi".charAt(1) === 'i')
  }

  // ...
}

For details on the importing approach, see the documentation
for the AssertionsForJUnit companion object.
For the details on the AssertionsForJUnit syntax, see the Scaladoc documentation for
org.scalatest.Assertions

        

        class

              JUnit3Suite
             extends TestCase with Suite with AssertionsForJUnit

A Suite that is also a junit.framework.TestCase.

A Suite that is also a junit.framework.TestCase.

A JUnit3Suite may be run by either JUnit 3 (such as JUnit 3.8) or ScalaTest's runner. You write it the way
you write a JUnit 3 TestCase. Tests are methods that start with test, take no parameters, and
have a Unit return type. You manage fixtures with methods setUp and tearDown.
Here's an example:

import org.scalatest.junit.JUnit3Suite
import scala.collection.mutable.ListBuffer

class BlastFromThePastSuite extends JUnit3Suite {

  var sb: StringBuilder = _
  var lb: ListBuffer[String] = _

  override def setUp(): Unit = {
    sb = new StringBuilder("ScalaTest is ")
    lb = new ListBuffer[String]
  }

  def testEasy(): Unit = { // Uses JUnit-style assertions
    sb.append("easy!")
    assertEquals("ScalaTest is easy!", sb.toString)
    assertTrue(lb.isEmpty)
    lb += "sweet"
  }

  def testFun(): Unit = { // Uses ScalaTest assertions
    sb.append("fun!")
    assert(sb.toString === "ScalaTest is fun!")
    assert(lb.isEmpty)
  }
}

You can use either JUnit's assertions, inherited from TestCase, or ScalaTest's, inherited from AssertionsForJUnit.

When writing JUnit 3 tests in Scala, you should keep in mind that JUnit 3 will not run tests that have a return type other than
Unit. Thus it is best to explicitly state the Unit result type, like this:

def testGoodIdea(): Unit = { // result type will be Unit
  // ...
}

Instead of this:

def testBadIdea() = { // result type will be inferred
  // ...
}

If the testBadIdea method ends in an expression that has a result type other than Unit, the Scala
compiler will infer a result type to the testBadIdea method to be the same non-Unit type. As a "result,"
JUnit 3 will not discover or run the testBadIdea method at all.

        

        final
        class

              JUnitRunner
             extends Runner

A JUnit Runner that knows how to run any ScalaTest Suite.

A JUnit Runner that knows how to run any ScalaTest Suite.
This enables you to provide a JUnit RunWith annotation on any
ScalaTest Suite. Here's an example:

import org.junit.runner.RunWith
import org.scalatest.junit.JUnitRunner
import org.scalatest.FunSuite

@RunWith(classOf[JUnitRunner])
class MySuite extends FunSuite {
  // ...
}

This RunWith annotation will enable the MySuite class
to be run by JUnit 4.

        

        class

              JUnitSuite
             extends JUnitSuiteLike

A suite of tests that can be run with either JUnit or ScalaTest.

A suite of tests that can be run with either JUnit or ScalaTest. This class allows you to write JUnit 4 tests
with ScalaTest's more concise assertion syntax as well as JUnit's assertions (assertEquals, etc.).
You create tests by defining methods that are annotated with Test, and can create fixtures with
methods annotated with Before and After. For example:

import org.scalatest.junit.JUnitSuite
import scala.collection.mutable.ListBuffer
import _root_.org.junit.Test
import _root_.org.junit.Before

class TwoSuite extends JUnitSuite {

  var sb: StringBuilder = _
  var lb: ListBuffer[String] = _

  @Before def initialize() {
    sb = new StringBuilder("ScalaTest is ")
    lb = new ListBuffer[String]
  }

  @Test def verifyEasy() {
    sb.append("easy!")
    assert(sb.toString === "ScalaTest is easy!")
    assert(lb.isEmpty)
    lb += "sweet"
  }

  @Test def verifyFun() {
    sb.append("fun!")
    assert(sb.toString === "ScalaTest is fun!")
    assert(lb.isEmpty)
  }
}

To execute JUnitSuites with ScalaTest's Runner, you must include JUnit's jar file on the class path or runpath.
This version of JUnitSuite was tested with JUnit version 4.10.

Instances of this class are not thread safe.

        

        trait

              JUnitSuiteLike
             extends Suite with AssertionsForJUnit

Implementation trait for class JUnitSuite, which represents
a suite of tests that can be run with either JUnit or ScalaTest.

Implementation trait for class JUnitSuite, which represents
a suite of tests that can be run with either JUnit or ScalaTest.

JUnitSuite is a class, not a
trait, to minimize compile time given there is a slight compiler overhead to
mixing in traits compared to extending classes. If you need to mix the
behavior of JUnitSuite into some other class, you can use this
trait instead, because class JUnitSuite does nothing more than
extend this trait.

See the documentation of the class for a detailed
overview of JUnitSuite.

        

        class

              JUnitTestFailedError
             extends AssertionFailedError with StackDepth with ModifiableMessage[JUnitTestFailedError] with PayloadField with ModifiablePayload[JUnitTestFailedError]

Exception that indicates a test failed.

Exception that indicates a test failed.

The purpose of this exception is to encapsulate the same stack depth information provided by
TestFailedException, which is used
when running with ScalaTest, but be reported as
a failure not an error when running with JUnit.
The stack depth information indicates which line of test code failed, so that when running
with ScalaTest information can be presented to
the user that makes it quick to find the failing line of test code. (In other words, when
running with ScalaTest the user need not scan through the stack trace to find the correct filename
and line number of the failing test.)

JUnit distinguishes between failures and errors.
If a test fails because of a failed assertion, that is considered a failure in JUnit. If a test
fails for any other reason, either the test code or the application being tested threw an unexpected
exception, that is considered an error in JUnit. This class differs from
TestFailedException in that it extends
junit.framework.AssertionFailedError. Instances of this class are thrown by the
assertions provided by AssertionsForJUnit.

The way JUnit 3 (JUnit 3.8 and earlier releases) decided whether an exception represented a failure or error
is that only thrown junit.framework.AssertionFailedErrors were considered failures. Any other
exception type was considered an error. The exception type thrown by the JUnit 3 assertion methods declared
in junit.framework.Assert (such as assertEquals, assertTrue,
and fail) was, therefore, AssertionFailedError. In JUnit 4, AssertionFailedError
was made to extend java.lang.AssertionError, and the distinction between failures and errors
was essentially dropped. However, some tools that integrate with JUnit carry on this distinction, so even
if you are using JUnit 4 you may want to use AssertionsForJUnit.

Exceptions thrown

NullArgumentException if either message or cause is null, or Some(null).

        

        class

              JUnitWrapperSuite
             extends Suite

A wrapper to allow JUnit tests to be run by the ScalaTest runner.

A wrapper to allow JUnit tests to be run by the ScalaTest runner.

Instances of this trait are not thread safe.

Value Members

        

        object

              AssertionsForJUnit
             extends AssertionsForJUnit

Companion object that facilitates the importing of AssertionsForJUnit members as
an alternative to mixing it in.

Companion object that facilitates the importing of AssertionsForJUnit members as
an alternative to mixing it in. One use case is to import AssertionsForJUnit members so you can use
them in the Scala interpreter:

$ scala -cp junit3.8.2/junit.jar:../target/jar_contents
Welcome to Scala version 2.7.5.final (Java HotSpot(TM) Client VM, Java 1.5.0_16).
Type in expressions to have them evaluated.
Type :help for more information.

scala> import org.scalatest.junit.AssertionsForJUnit._
import org.scalatest.junit.AssertionsForJUnit._

scala> assert(1 === 2)
junit.framework.AssertionFailedError: 1 did not equal 2
	at org.scalatest.junit.AssertionsForJUnit$class.assert(AssertionsForJUnit.scala:353)
	at org.scalatest.junit.AssertionsForJUnit$.assert(AssertionsForJUnit.scala:672)
	at .<init>(<console>:7)
	at .<clinit>(<console>)
	at RequestResult$.<init>(<console>:3)
	at RequestResult$.<clinit>(<console>)
	at RequestResult$result(<consol...
scala> expect(3) { 1 + 3 }
junit.framework.AssertionFailedError: Expected 3, but got 4
	at org.scalatest.junit.AssertionsForJUnit$class.expect(AssertionsForJUnit.scala:563)
	at org.scalatest.junit.AssertionsForJUnit$.expect(AssertionsForJUnit.scala:672)
	at .<init>(<console>:7)
	at .<clinit>(<console>)
	at RequestResult$.<init>(<console>:3)
	at RequestResult$.<clinit>(<console>)
	at RequestResult$result(<co...
scala> val caught = intercept[StringIndexOutOfBoundsException] { "hi".charAt(-1) }
caught: StringIndexOutOfBoundsException = java.lang.StringIndexOutOfBoundsException: String index out of range: -1

Ungrouped


text:
package org.apache.pulsar.common.policies.data;

import static org.testng.Assert.assertEquals;

import org.apache.pulsar.common.policies.data.PartitionedTopicStats;
import org.apache.pulsar.common.policies.data.PersistentSubscriptionStats;
import org.apache.pulsar.common.policies.data.PublisherStats;
import org.apache.pulsar.common.policies.data.ReplicatorStats;
import org.testng.annotations.Test;

public class PartitionedTopicStatsTest {

    @Test
    public void testPartitionedTopicStats() {
        PartitionedTopicStats partitionedTopicStats = new PartitionedTopicStats();
        partitionedTopicStats.msgRateIn = 1;
        partitionedTopicStats.msgThroughputIn = 1;
        partitionedTopicStats.msgRateOut = 1;
        partitionedTopicStats.msgThroughputOut = 1;
        partitionedTopicStats.averageMsgSize = 1;
        partitionedTopicStats.storageSize = 1;
        partitionedTopicStats.publishers.add(new PublisherStats());
        partitionedTopicStats.subscriptions.put("test_ns", new PersistentSubscriptionStats());
        partitionedTopicStats.replication.put("test_ns", new ReplicatorStats());
        partitionedTopicStats.metadata.partitions = 1;
        partitionedTopicStats.partitions.put("test", partitionedTopicStats);
        partitionedTopicStats.reset();
        assertEquals(partitionedTopicStats.msgRateIn, 0.0);
        assertEquals(partitionedTopicStats.msgThroughputIn, 0.0);
        assertEquals(partitionedTopicStats.msgRateOut, 0.0);
        assertEquals(partitionedTopicStats.msgThroughputOut, 0.0);
        assertEquals(partitionedTopicStats.averageMsgSize, 0.0);
        assertEquals(partitionedTopicStats.storageSize, 0);
        assertEquals(partitionedTopicStats.publishers.size(), 0);
        assertEquals(partitionedTopicStats.subscriptions.size(), 0);
        assertEquals(partitionedTopicStats.replication.size(), 0);
        assertEquals(partitionedTopicStats.metadata.partitions, 0);
        assertEquals(partitionedTopicStats.partitions.size(), 0);
    }
}

redpajama_set_name: RedPajamaGithub


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">
<html>
<head>
	<title>$(PROJECT_DISPLAY_NAME)</title>

	<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>

	<!-- Browser Compatibility Meta Tags for Internet Explorer v8+ -->
	<meta http-equiv="x-ua-compatible" content="ie=edge; chrome=1"/>

	<!-- Authoring Meta Tags -->
	<meta name="author" 	content="$(TAGS.OG_COMPANY_NAME)"/>
	<meta name="publisher"	content="$(TAGS.OG_PUBLISHER)"/>
	<meta name="copyright"	content="$(TAGS.OG_COPYRIGHT)"/>
	<meta name="host"		content="$(TAGS.OG_HOST)"/>
	<meta name="generator"	content="Coconut2D Studio IDE"/>

	<!-- Cache Control -->
	<meta http-equiv="cache-control" content="public"/>
	<META HTTP-EQUIV="Pragma" CONTENT="no-cache">

	<!-- Required for IE -->
	<META HTTP-EQUIV="Expires" CONTENT="-1">

	<!-- Bookmark Meta Tags -->
	<link rel='bookmark' title='$(PROJECT_DISPLAY_NAME)' href='$(TAGS.OG_URL)'/>

	<!-- Favicon Meta Tags -->
	<link rel="icon" 		  type="image/x-icon" href="favicon.ico"/>
	<link rel="shortcut icon" type="image/x-icon" href="favicon.ico"/>

	<!-- Apple Meta Tags -->
	<meta name="apple-mobile-web-app-capable" 			content="yes"/>
	<meta name="mobile-web-app-capable" 				content="yes">
	<meta name="apple-mobile-web-app-status-bar-style" 	content="black"/>
	<meta name="apple-mobile-web-app-title" 			content="$(PROJECT_DISPLAY_NAME)"/>
	<meta name="apple-touch-fullscreen" 				content="yes"/>
	<meta name="format-detection" 						content="telephone=no"/>
	<meta name="viewport" 								content="width=device-width, height=device-height, initial-scale=1.0, minimum-scale=1.0, user-scalable=no, maximum-scale=1.0, minimal-ui"/>

	<!-- Google Meta Tags -->
	<meta name="mobile-web-app-capable" 				content="yes">

	<!-- Apple Touch Icon for iPad and iPhone Meta Tag -->
	<link rel="apple-touch-icon-precomposed" type="image/png" media="screen" 				 href="apple-touch-icon.png"/>
	<link rel="apple-touch-icon-precomposed" type="image/png" media="screen" sizes="57x57" 	 href="apple-touch-icon-57x57.png"/>
	<link rel="apple-touch-icon-precomposed" type="image/png" media="screen" sizes="72x72" 	 href="apple-touch-icon-72x72.png"/>
	<link rel="apple-touch-icon-precomposed" type="image/png" media="screen" sizes="76x76" 	 href="apple-touch-icon-76x76.png"/>
	<link rel="apple-touch-icon-precomposed" type="image/png" media="screen" sizes="114x114" href="apple-touch-icon-114x114.png"/>
	<link rel="apple-touch-icon-precomposed" type="image/png" media="screen" sizes="120x120" href="apple-touch-icon-120x120.png"/>
	<link rel="apple-touch-icon-precomposed" type="image/png" media="screen" sizes="144x144" href="apple-touch-icon-144x144.png"/>
	<link rel="apple-touch-icon-precomposed" type="image/png" media="screen" sizes="152x152" href="apple-touch-icon-152x152.png"/>

    <!-- Apple Mobile Browser Startup Image -->
	<link rel="apple-touch-startup-image" type="image/jpeg" media="screen" href="splash.jpg"/>
	<link rel="apple-touch-startup-image" type="image/jpeg" media="screen and (resolution: 326dpi)" href="splash@2x.jpg"/>

	<!-- Search Engine Robots Meta Tags -->
	<meta name="revisit-after" content="10 days"/>
	<meta name="googlebot" content="noodp"/>
	<meta name="msnbot" content="noodp"/>
	<meta name="slurp" content="noodp, noydir"/> <!--yahoo-->
	<meta name="teoma" content="noodp"/> <!--ask-->
	<meta name="robots" content="index, follow, noodp, noydir, noarchive"/>

	<!-- Open Graph Protocol OG Meta Tags (Facebook Opengraph Meta Tags) -->
	<meta property="fb:app_id" 			content="$(FACEBOOK.APPID)"/>
	<meta property="og:image" 			content="$(TAGS.OG_HOST)/$(PROJECT_NAME).jpg"/> <!--used for Facebook Share thumbnail-->
	<meta property="og:title" 			content="$(TAGS.OG_TITLE)"/>
	<meta property="og:description" 	content="$(TAGS.OG_DESCRIPTION)"/>
	<meta property="og:site_name" 		content="$(PROJECT_NAME)"/>
	<meta property="og:url" 			content="$(TAGS.OG_URL)"/>
	<meta property="og:type" 			content="game"/>
	<meta property="og:price:amount" 	content="$(TAGS.OG_PRICE)"/>
	<meta property="og:price:currency" 	content="$(TAGS.OG_CURRENCY)"/>
	<meta property="og:availability" 	content="instock"/> <!--instock/in stock/preorder/backorder/out of stock/discontinued-->
	<meta property="og:brand" 			content="$(TAGS.OG_COMPANY_NAME)"/>
	<meta property="og:street-address" 	content="$(TAGS.OG_COMPANY_ADDRESS)"/>
	<meta property="og:region" 			content="$(TAGS.OG_COMPANY_REGION)"/>
	<meta property="og:postal-code" 	content="$(TAGS.OG_COMPANY_POSTCODE)"/>
	<meta property="og:country-name" 	content="$(TAGS.OG_COMPANY_COUNTRY)"/>
	<meta property="og:email" 			content="$(TAGS.OG_COMPANY_EMAIL)"/>
	<meta property="og:phone_number" 	content="$(TAGS.OG_COMPANY_PHONE)"/>
	<meta property="og:video" 			content="$(TAGS.OG_DEMO_VIDEO_URL)"/>
	<meta property="og:video:height" 	content="$(TAGS.OG_DEMO_VIDEO_WIDTH)"/>
	<meta property="og:video:width" 	content="$(TAGS.OG_DEMO_VIDEO_HEIGHT)"/>
	<meta property="og:video:type" 		content="application/x-shockwave-flash"/>

   <style type="text/css">

    body
    {
		overflow: hidden;
		margin: 0;
		padding: 0;
		border: none;
		width:$(TARGETS.HTML5.APP_SETTINGS.HTML_BODY_WIDTH);
		height:$(TARGETS.HTML5.APP_SETTINGS.HTML_BODY_HEIGHT);
		text-rendering: optimizeLegibility;
		font-smooth: always;
		-webkit-font-smoothing: antialiased;
		image-rendering: -webkit-optimize-contrast;
		-webkit-transform-style: preserve-3d;
		background-color:black;
    }

	image, canvas
	{
	    user-select: none;
	    -ms-user-select: none;
	    -webkit-user-select: none;
	    -khtml-user-select: none;
	    -moz-user-select: none;
	    -webkit-touch-callout: none;
	    -webkit-user-drag: none;
	    tap-highlight-color: transparent;
	    -ms-tap-highlight-color: transparent;
	    -moz-tap-highlight-color: transparent;
	    -khtml-tap-highlight-color: transparent;
	    -webkit-tap-highlight-color: transparent;
	}

	.font_loader
	{
		top:0px;
		left:0px;
		position:absolute;
		visibility:hidden;
	}

    </style>

	$(SCRIPTS)

</head>

<body>

$(BODY)

</body>

</html>


text:
/*
 * barcode generator
 */

var fs = require('fs'),
  path = require('path');

module.exports = function (moduleName, options) {
  options.data = options.data || '';
  options.barcolor = options.barcolor || '#000';
  options.bgcolor = options.bgcolor || '#FFF';
  options.w = options.width || 0;
  options.h = options.height || 0;
  options.type = (options.type) ? options.type.toUpperCase().trim() : 'PNG';

  return new Barcode(moduleName, options);
}

function Barcode(moduleName, options) {
  this.barcode = require('./lib/' + moduleName.toLowerCase());
  this.options = options;
}

Barcode.prototype.getStream = function (callback) {
  this.barcode.createCode(this.options, function (err, stream) {
    callback(err, stream);
  });
}

Barcode.prototype.saveImage = function (outfile, callback) {
  this.getStream(function (err, stream) {
    if (err) return callback(err, '');

    var ws = fs.createWriteStream(outfile);
    stream.pipe(ws);

    stream.on('end', function () {
      callback(false, outfile);
    });

    stream.on('error', function (err) {
      callback(err, '');
    });
  });
}

Barcode.prototype.getBase64 = function (callback) {
  var type = this.options.type || 'PNG';

  this.getStream(function (err, stream) {
    if (err) return callback(err, '');

    var imgBufs = [];
    stream.on('data', function (chunk) {
      imgBufs.push(chunk);
    });

    stream.on('end', function () {
      var src = 'data:image/' + type + ';base64,';
      src += Buffer.concat(imgBufs).toString('base64');
      callback(false, src);
    });

    stream.on('error', function (err) {
      callback(err, '')
    });
  });
}


text:
package ru.job4j.substring;

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

/**
 *@author Nikita Zenkin.
 *@since 02.06.2017.
 *@version 1.
*/

public class FinalTest {
	/**
	 * This method tests method contains which one must check is string contains substring.
	 * Expected boolean value true if string contains substring.
	*/
    @Test
	public void whenStringContainsSubStringThenTrue() {
		Final finalTask = new Final();
		boolean result = finalTask.contains("момоко", "моко");
		boolean expected = true;
		assertThat(result, is(expected));
	}
	/**
	 * This method tests method contains which one must check is string contains substring.
	 * Expected boolean value false if string isn't contains substring.
	*/
    @Test
	public void whenStringIsNotContainsSubStringThenFalse() {
		Final finalTask = new Final();
		boolean result = finalTask.contains("момоко", "моо");
		boolean expected = false;
		assertThat(result, is(expected));
	}
}


text:
/*************************************************************************/
/*                                                                       */
/*                Centre for Speech Technology Research                  */
/*                     University of Edinburgh, UK                       */
/*                       Copyright (c) 1996,1997                         */
/*                        All Rights Reserved.                           */
/*                                                                       */
/*  Permission is hereby granted, free of charge, to use and distribute  */
/*  this software and its documentation without restriction, including   */
/*  without limitation the rights to use, copy, modify, merge, publish,  */
/*  distribute, sublicense, and/or sell copies of this work, and to      */
/*  permit persons to whom this work is furnished to do so, subject to   */
/*  the following conditions:                                            */
/*   1. The code must retain the above copyright notice, this list of    */
/*      conditions and the following disclaimer.                         */
/*   2. Any modifications must be clearly marked as such.                */
/*   3. Original authors' names are not deleted.                         */
/*   4. The authors' names are not used to endorse or promote products   */
/*      derived from this software without specific prior written        */
/*      permission.                                                      */
/*                                                                       */
/*  THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK        */
/*  DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING      */
/*  ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT   */
/*  SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE     */
/*  FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES    */
/*  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN   */
/*  AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,          */
/*  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF       */
/*  THIS SOFTWARE.                                                       */
/*                                                                       */
/*************************************************************************/
/*                 Authors:  Alan W Black                                */
/*                 Date   :  November 1996                               */
/*-----------------------------------------------------------------------*/
/*  Some basic functions for dealing with the web and urls               */
/*                                                                       */
/*=======================================================================*/
#include <cstdio>
#include "EST_unix.h"
#include <cstdlib>
#include "festival.h"
#include "festivalP.h"
#include "EST_String.h"

#if 0
static int getc_unbuffered(int fd,int *c);
#endif

LISP parse_url(EST_String url)
{
  EST_String protocol, host, port, path;

  if (!parse_url(url, protocol, host, port, path))
    err("can't parse URL", url);

  return cons(strintern(protocol),
	      cons(strintern(host),
		   cons(strintern(port),
			cons(strintern(path), NIL))));
}

LISP lisp_parse_url(LISP l_url)
{
  EST_String url(get_c_string(l_url));

  return parse_url(url);
}

#if 0
LISP lisp_get_url(LISP url,LISP filename)
{
    // Copy file identified by URL and copy it to filename
    // Current only file:/.../... and http:/.../... are supported
    EST_TokenStream us;
    EST_String host,file,port;
    char *comm = walloc(char,32+strlen(get_c_string(url)));
    char *getstr = walloc(char,32+strlen(get_c_string(filename)));
    int wwwserver=-1,c;
    FILE *fd, *fin, *fout;

    // first parse the url
    us.open_string(get_c_string(url));
    us.set_WhiteSpaceChars("");
    us.set_SingleCharSymbols(":/");

    if (us.peek() == "http")
    {
	us.get();
	if ((us.get() != ":") ||
	    (us.get() != "/") ||
	    (us.get() != "/"))
	{
	    cerr << "url_get: malformed url" << endl;
	    festival_error();
	}
	host = us.get().string();  // upto next /
	if (us.peek() == ":")      // a port is specified
	{
	    us.get();
	    port = us.get().string();
	}
	else
	    port = "80";           // standard port for http servers
	file = us.get_upto_eoln();
	sprintf(comm,"telnet %s %s",(const char *)host,(const char *)port);
	wwwserver = festival_socket_client(host,atoi(port));
	if (wwwserver < 0)
	{
	    cerr << "get_url: can't access server\n";
	    festival_error();
	}
	fout = fdopen(wwwserver,"wb");
	fprintf(fout,"GET %s\n",(const char *)file);
	fflush(fout);

	if ((fd=fopen(get_c_string(filename),"wb")) == NULL)
	{
	    cerr << "get_url: can't open outputfile \"" <<
		get_c_string(filename) << "\"\n";
	    festival_error();
	}
	else
	{
	    while (getc_unbuffered(wwwserver,&c) != EOF)
		putc(c,fd);
	    fclose(fd);
	}

	close(wwwserver);
	wfree(comm);
	wfree(getstr);
    }
    else if (us.peek() == "file")
    {
	us.get();
	if (us.get() != ":")
	{
	    cerr << "url_get: malformed url" << endl;
	    festival_error();
	}
	file = us.get_upto_eoln();
	if ((fin = fopen(file,"rb")) == NULL)
	{
	    cerr << "get_url: unable to access file url \"" <<
		get_c_string(url) << "\"\n";
	    festival_error();
	}
	if ((fd=fopen(get_c_string(filename),"wb")) == NULL)
	{
	    cerr << "get_url: can't open outputfile \"" <<
		get_c_string(filename) << "\"\n";
	    fclose(fin);
	    festival_error();
	}
	else
	{
	    while ((c=getc(fin)) != EOF)
		putc(c,fd);
	    fclose(fd);
	    fclose(fin);
	}
    }
    else
    {
	cerr << "get_url: unrecognizable url \"" <<
	    get_c_string(url) << "\"\n";
	festival_error();
    }

    return NIL;
}

LISP l_open_socket(LISP host, LISP port, LISP how)
{
    // Open socket to remote server
    int fd;
    char *how_c;

    fd = festival_socket_client(get_c_string(host),get_c_int(port));
    if (streq(get_c_string(how),"rw"))
    {   // return list of r and w FILEDESCRIPTORS
	return cons(siod_fdopen_c(fd,
				  EST_String(get_c_string(host))+
                                     ":"+get_c_string(port),
				  "rb"),
		    cons(siod_fdopen_c(fd,
				       EST_String(get_c_string(host))+
				          ":"+get_c_string(port),
				       "wb"),NIL));
    }
    else
    {
	if (how == NIL)
	    how_c = "wb";
	else
	    how_c = get_c_string(how);
	return siod_fdopen_c(fd,
			     EST_String(get_c_string(host))+":"+get_c_string(port),
			     how_c);
    }
}

static int getc_unbuffered(int fd,int *rc)
{
    // An attempted to get rid of the buffering
    char c;
    int n;

    n = read(fd,&c,1);
    *rc = c;
    if (n == 0)
	return EOF;
    else
	return 0;
}

#endif


text:
lock '3.4.0'

set :application, 'Sakura'
set :repo_url, 'https://github.com/osak/Sakura.git'

# Default branch is :master
# ask :branch, proc { `git rev-parse --abbrev-ref HEAD`.chomp }.call

# Default deploy_to directory is /var/www/my_app
set :deploy_to, '/var/www/Sakura'

# Default value for :scm is :git
set :scm, :git

# Default value for :format is :pretty
# set :format, :pretty

# Default value for :log_level is :debug
# set :log_level, :debug

# Default value for :pty is false
# set :pty, true

# Default value for :linked_files is []
set :linked_files, %w{config/database.yml config/secrets.yml}

# Default value for linked_dirs is []
set :linked_dirs, %w{log tmp/pids public/uploads}

# Default value for default_env is {}
# set :default_env, { path: "/opt/ruby/bin:$PATH" }

# Default value for keep_releases is 5
# set :keep_releases, 5

#set :rbenv_type, :user
#set :rbenv_ruby, 2.1.1

set :user, 'sakura'
set :rails_env, 'production'

set :bundle_flags, '--deployment -j4'

namespace :deploy do

  desc 'Restart application'
  task :restart do
    on roles(:app), in: :sequence, wait: 5 do
      invoke "unicorn:restart"
    end
  end

  after :publishing, :restart

  after :restart, :clear_cache do
    on roles(:web), in: :groups, limit: 3, wait: 10 do
    end
  end
end


text:
   /*******************************************************/
   /*      "C" Language Integrated Production System      */
   /*                                                     */
   /*            CLIPS Version 6.40  01/06/16             */
   /*                                                     */
   /*                 FACT HASHING MODULE                 */
   /*******************************************************/

/*************************************************************/
/* Purpose:                                                  */
/*                                                           */
/* Principal Programmer(s):                                  */
/*      Gary D. Riley                                        */
/*                                                           */
/* Contributing Programmer(s):                               */
/*                                                           */
/* Revision History:                                         */
/*                                                           */
/*      6.24: Removed LOGICAL_DEPENDENCIES compilation flag. */
/*                                                           */
/*            Renamed BOOLEAN macro type to intBool.         */
/*                                                           */
/*      6.30: Fact hash table is resizable.                  */
/*                                                           */
/*            Changed integer type/precision.                */
/*                                                           */
/*            Added FactWillBeAsserted.                      */
/*                                                           */
/*            Converted API macros to function calls.        */
/*                                                           */
/*      6.40: Modify command preserves fact id and address.  */
/*                                                           */
/*************************************************************/

#ifndef _H_facthsh

#pragma once

#define _H_facthsh

struct factHashEntry;

#include "factmngr.h"

struct factHashEntry
  {
   struct fact *theFact;
   struct factHashEntry *next;
  };

#define SIZE_FACT_HASH 16231

   void                           AddHashedFact(void *,struct fact *,unsigned long);
   bool                           RemoveHashedFact(void *,struct fact *);
   unsigned long                  HandleFactDuplication(void *,void *,bool *,long long);
   bool                           EnvGetFactDuplication(void *);
   bool                           EnvSetFactDuplication(void *,bool);
   void                           InitializeFactHashTable(void *);
   void                           ShowFactHashTable(UDFContext *,CLIPSValue *);
   unsigned long                  HashFact(struct fact *);
   bool                           FactWillBeAsserted(void *,void *);

#endif /* _H_facthsh */


text:
'use strict';

var config        = require('../config');
var gulp          = require('gulp');

gulp.task('watch', ['browserSync', 'server'], function() {

  // Scripts are automatically watched and rebundled by Watchify inside Browserify task
  gulp.watch(config.scripts.src, ['lint']);
  gulp.watch(config.styles.src,  ['styles']);
  gulp.watch(config.images.src,  ['images']);
  gulp.watch(config.views.watch, ['views']);

});