text:
Hello World
===========

This example illustrates how to use SimpleElastix. With a single function call we can specify the fixed image, the moving image and the type of registration you want to perform. SimpleElastix will then register our images using sensible default parameters that work well in most cases. In later examples we shall see how to tweak the default parameters, but for now we keep it simple.

Registration With Translation Transform
---------------------------------------

Say we want to register the following two brain MRIs.

.. _fig:

    .. image::  _static/BrainProtonDensity.png
       :width: 45%
       :align: left
    .. image::  _static/BrainProtonDensityTranslated13x17y.png
       :width: 45%
       :align: left

    .. class:  center

    Figure 2. The original image :code:`fixedImage.nii` (left) and translated image :code:`movingImage.nii` (right).

We identify that the objects are related by a simple spatial shift and that a translation transform should be sufficient to align the objects. To correct the misalignment, we run the following lines of python code:

::

  import SimpleITK as sitk

  resultImage = sitk.Elastix(sitk.ReadImage("fixedImage.nii"), \
                             sitk.ReadImage("movingImage.nii"), \
                             "translation")

That's it! We have effectively registered two images using a single line of code. Compare this to the `ITK Hello World example <https://github.com/InsightSoftwareConsortium/ITK/blob/master/Examples/RegistrationITKv4/DeformableRegistration1.cxx>`_. We refer to this short-hand notation as the procedural interface (some people also refer to it as the functional interface) because it consists of functions that accomplish a specific task. The procedural interface is less flexible than the object-oriented interface introduced below, but it is very simple to use. Let's break down what goes on under the hood of this single function call.

First of all, :code:`import SimpleITK as sitk` loads the SimpleITK module from which SimpleElastix is accessed. This assumes that SimpleElastix has been compiled and installed on your machine.

:code:`sitk.ReadImage()` is the generic image file reader of SimpleITK which loads an image from disk and pass a SimpleITK image object to SimpleElastix. You can also apply a SimpleITK filter to an image before passing them to SimpleElastix. For example, you could use the :code:`ResampleImageFilter()` to downsample images that would otherwise consume too much memory during registration.

The final parameter :code:`"translation"` specifies the desired type of registration. In the Parameter Maps section we will take a close look at parameter maps and examine what happens when you specify this parameter. It is obvious from the figure below that a translation transform is sufficient to align these images.

.. _fig2:

    .. image::  _static/PreTranslated.jpeg
       :width: 45%
       :align: left
    .. image::  _static/PostTranslated.jpeg
       :width: 45%
       :align: left

    .. class:  center

    Figure 3. Mean image before registration (left) and mean image after registration (right). The fixed image is shown the red color channel and the moving image is shown in the blue color channel.

Object-Oriented Interface
-------------------------

The example above used procedural interface. While the procedural interface may be useful for rapid prototyping, it trades off flexibility for code simplicity. For example, the final deformation field cannot be retrived and applied to another image. This is a problem if we want to subsequently warp other images, e.g. a label image, using the same transformation. Further, image quality is reduced from resampling the resulting image twice. To this end, SimpleElastix comes with a more flexible object-oriented interface suitable for more advanced use cases and scripting purposes. In the next example, we perform the same registration as above, but this time using the object oriented interface:

::

    import SimpleITK as sitk

    fixedImage = sitk.ReadImage('fixedImage.nii')
    movingImage = sitk.ReadImage('movingImage.nii')
    parameterMap = sitk.GetDefaultParameterMap('translation')

    elastixImageFilter = sitk.ElastixImageFilter()
    elastixImageFilter.SetFixedImage(fixedImage)
    elastixImageFilter.SetMovingImage(movingImage)
    elastixImageFilter.SetParameterMap(parameterMap)
    elastixImageFilter.Execute()

    resultImage = elastixImageFilter.GetResultImage()
    transformParameterMap = elastixImageFilter.GetTransformParameterMap()

This is more verbose but also a lot more powerful. We can now warp an entire population of images (e.g. binary label images for segmentation of different brain regions) using the same parameter map and a single instance of transformix:

::

    transformixImageFilter = sitk.TransformixImageFilter()
    transformixImageFilter.SetTransformParameterMap(transformParameterMap)

    population = ['image1.hdr', 'image2.hdr', ... , 'imageN.hdr']

    for filename in population:
        transformixImageFilter.SetMovingImage(sitk.ReadImage(filename))
        transformixImageFilter.Execute()
        sitk.WriteImage(transformixImageFilter.GetResultImage(), "result_"+filename)

The object-oriented interface facilitates reuse of components and dramatically simplifies book-keeping and boilerplate code. We will use the object-oriented interface in the documentation from this point forward.

In the next section, we will take a closer look at the parameter map interface that configures the registration components.


text:
//=================================================================================================

//=================================================================================================

#ifndef _BLAZE_UTIL_TYPETRAITS_REMOVEALLEXTENTS_H_
#define _BLAZE_UTIL_TYPETRAITS_REMOVEALLEXTENTS_H_

//*************************************************************************************************
// Includes
//*************************************************************************************************

#include <type_traits>

namespace blaze {

//=================================================================================================
//
//  CLASS DEFINITION
//
//=================================================================================================

//*************************************************************************************************
/*!\brief Removal of all array extents.
// \ingroup type_traits
//
// The RemoveAllExtents type trait removes all array extents from the given type \a T.

   \code
   blaze::RemoveAllExtents<int>::Type           // Results in 'int'
   blaze::RemoveAllExtents<int const[2]>::Type  // Results in 'int const'
   blaze::RemoveAllExtents<int[2][4]>::Type     // Results in 'int'
   blaze::RemoveAllExtents<int[][2]>::Type      // Results in 'int'
   blaze::RemoveAllExtents<int[2][3][4]>::Type  // Results in 'int'
   blaze::RemoveAllExtents<int const*>::Type    // Results in 'int const*'
   \endcode
*/
template< typename T >
struct RemoveAllExtents
{
 public:
   //**********************************************************************************************
   /*! \cond BLAZE_INTERNAL */
   using Type = typename std::remove_all_extents<T>::type;
   /*! \endcond */
   //**********************************************************************************************
};
//*************************************************************************************************

//*************************************************************************************************
/*!\brief Auxiliary alias declaration for the RemoveAllExtents type trait.
// \ingroup type_traits
//
// The RemoveAllExtents_t alias declaration provides a convenient shortcut to access the nested
// \a Type of the RemoveAllExtents class template. For instance, given the type \a T the following
// two type definitions are identical:

   \code
   using Type1 = typename blaze::RemoveAllExtents<T>::Type;
   using Type2 = blaze::RemoveAllExtents_t<T>;
   \endcode
*/
template< typename T >
using RemoveAllExtents_t = typename RemoveAllExtents<T>::Type;
//*************************************************************************************************

} // namespace blaze

#endif

redpajama_set_name: RedPajamaGithub


text:
package com.irurueta.server.commons.configuration;

import org.junit.Test;

import javax.servlet.RequestDispatcher;
import javax.servlet.Servlet;
import javax.servlet.ServletContext;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.Enumeration;
import java.util.Properties;
import java.util.Set;

import static org.junit.Assert.*;

public class PropertiesFileLocatorTest {

    @Test
    public void testConstructor() {

        PropertiesFileLocator<PropertiesFileLocatorTest> locator =
                new PropertiesFileLocator<>("file");
        assertNotNull(locator);

        locator = new PropertiesFileLocator<>(this);
        assertNotNull(locator);

        locator = new PropertiesFileLocator<>(null, this);
        assertNotNull(locator);

        locator = new PropertiesFileLocator<>(this, "file");
        assertNotNull(locator);

        locator = new PropertiesFileLocator<>(null, this, "file");
        assertNotNull(locator);
    }

    @Test
    public void testLocate() throws IOException {
        PropertiesFileLocator<PropertiesFileLocatorTest> locator =
                new PropertiesFileLocator<>(this);

        //default properties is not found
        Properties props = locator.locate();
        assertTrue(props.isEmpty());

        locator = new PropertiesFileLocator<>(this, "test.properties");
        props = locator.locate();
        assertFalse(props.isEmpty());
        assertTrue(props.containsKey("key"));

        locator = new PropertiesFileLocator<>(new CustomServletContext(), this, "test.properties");
        props = locator.locate();
        assertFalse(props.isEmpty());
        assertTrue(props.containsKey("key"));
    }

    private static class CustomServletContext implements ServletContext {

        public String getContextPath() {
            return "context";
        }

        public ServletContext getContext(String s) {
            return null;
        }

        public int getMajorVersion() {
            return 0;
        }

        public int getMinorVersion() {
            return 0;
        }

        public String getMimeType(String s) {
            return null;
        }

        public Set<?> getResourcePaths(String s) {
            return null;
        }

        public URL getResource(String s) {
            return null;
        }

        public InputStream getResourceAsStream(String s) {
            return null;
        }

        public RequestDispatcher getRequestDispatcher(String s) {
            return null;
        }

        public RequestDispatcher getNamedDispatcher(String s) {
            return null;
        }

        public Servlet getServlet(String s) {
            return null;
        }

        public Enumeration<?> getServlets() {
            return null;
        }

        public Enumeration<?> getServletNames() {
            return null;
        }

        public void log(String s) {

        }

        public void log(Exception e, String s) {

        }

        public void log(String s, Throwable throwable) {

        }

        public String getRealPath(String s) {
            return null;
        }

        public String getServerInfo() {
            return null;
        }

        public String getInitParameter(String s) {
            return null;
        }

        public Enumeration<?> getInitParameterNames() {
            return null;
        }

        public Object getAttribute(String s) {
            return null;
        }

        public Enumeration<?> getAttributeNames() {
            return null;
        }

        public void setAttribute(String s, Object o) {

        }

        public void removeAttribute(String s) {

        }

        public String getServletContextName() {
            return null;
        }
    }
}


text:
<!DOCTYPE html>

	<title>Calendar Page</title>
	<meta charset="UTF-8">
	<link href="assets/css/bootstrap.css" rel="stylesheet" media="screen">
	<link href="assets/css/bootstrap-responsive.css" rel="stylesheet">
	<link href="calendar.css" rel="stylesheet">

    <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/start/jquery-ui.css"
   type="text/css" rel="Stylesheet" />

					<button class="btn btn-primary" id="prev_month_btn">Previous Month</button>
					<button class="btn btn-success" id="today_btn">Today</button>
					<button class="btn btn-primary" id="next_month_btn">Next Month</button>

					<button class="btn btn-info" id="view_year">Year</button>
					<button class="btn btn-info active" id="view_month">Month</button>
					<button class="btn btn-info" id="view_week">Week</button>

		<input type="text" name="event_title" id="event_title" placeholder="Title">
		<input type="text" name="event_date" id="event_date" placeholder="Date">

		<select name="event_tag" id="event_tag">
			<option value="meeting">Meeting</option>
			<option value="entertainment">Entertainment</option>
			<option value="sports">Sports</option>
			<option value="business">Business</option>
			<option value="other">Other</option>
		</select>

		<textarea class="form-control" rows="5" placeholder="Note(include your time here)" name="event_note" id="event_note"></textarea>

Share this event to:

		<select id="event_to_user" multiple="multiple"></select>

	    <button type="button" class="btn btn-info" id="create_btn">Submit</button>

		Username
	  	<input type="text" name="username" id="username" placeholder="Username">

	  	Password
	  	<input type="password" name="pwd" id="pwd" placeholder="Password">

	  	Name
	  	<input type="text" name="name" id="name" placeholder="Name">

	  	Email
	  	<input type="text" name="email" id="email" placeholder="Email address">

	  	<button type="button" class="btn btn-info" id="register_btn">Sign-up</button>

		Username
        <input type="text" name="inputUsername" id="inputUsername" placeholder="Username" required autofocus>

        Password
        <input type="password" name="inputPassword" id="inputPassword" placeholder="Password" required>

        <button type="button" class="btn btn-info" id="signin_btn">Login</button>

		<input type="text" name="edit_event_title" id="edit_event_title" placeholder="Title">

		<textarea class="form-control" rows="5" placeholder="Note" name="edit_event_note" id="edit_event_note"></textarea>

	    <button type="button" class="btn btn-info" id="confirm_edit_btn">Submit</button>

		<select id="select_user"></select>
		<button type="button" class="btn btn-info" id="share_user_btn_2">Share</button>


text:
namespace FirTree
{
    using System;

    public class FirTree
    {
        public static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int width = (n * 2) - 3;

            char asterix = '*';
            char dot = '.';
            int asterixCount = 1;
            int dotsCount = width / 2;

            for (int i = 0; i < n - 1; i++)
            {
                Console.Write(new string(dot, dotsCount));
                Console.Write(new string(asterix, asterixCount));
                Console.WriteLine(new string(dot, dotsCount));
                asterixCount += 2;
                dotsCount--;
            }

            Console.Write(new string(dot, width / 2));
            Console.Write(asterix);
            Console.WriteLine(new string(dot, width / 2));
        }
    }
}


text:
/* .charsheet label {
    display: inline-block;
    width: 100%;
    text-align: right;
    padding-bottom: 0;
} */

.charsheet input {
  display: inline-block;
  width: fit-content;
}

.charsheet {
  background-color: white;
}

.sheet-container {
  display: grid;
  overflow: scroll;
  grid-template-columns: repeat(3, minmax(270px, 1fr));
  grid-template-rows: repeat(10, fit-content);
  grid-template-areas: "header header header"
                        "character1 character2 character3"
                        "subhead1 subhead1 subhead1"
                        "attrib1 attrib2 attrib3"
                        "subhead2 subhead2 subhead2"
                        "ability1 ability2 ability3"
                        "subhead3 subhead3 subhead3"
                        "advantage1 advantage2 advantage3"
                        "extra1-1 extra1-2 extra1-3"
                        "extra2-1 extra2-2 extra2-3"
                        "extra3-1 extra3-2 extra3-3";
  grid-gap: 8px;
  margin: 0 2% 0 2%;
}

.sheet-header {
  grid-area: header;
  text-align: center;
}
.sheet-character1 {
  grid-area: character1;
  text-align: center;
}
.sheet-character2 {
  grid-area: character2;
  text-align: center;
}
.sheet-character3 {
  grid-area: character3;
  text-align: center;
}

.sheet-subhead1 {
  grid-area: subhead1;
  text-align: center;
}

.sheet-attrib1 {
  grid-area: attrib1;
  text-align: center;
}

.sheet-attrib2 {
  grid-area: attrib2;
  text-align: center;
}

.sheet-attrib3 {
  grid-area: attrib3;
  text-align: center;
}

.sheet-subhead2 {
  grid-area: subhead2;
  text-align: center;
}

.sheet-ability1 {
  grid-area: ability1;
  text-align: center;
}

.sheet-ability2 {
  grid-area: ability2;
  text-align: center;
}

.sheet-ability3 {
  grid-area: ability3;
  text-align: center;
}

.sheet-subhead3 {
  grid-area: subhead3 ;
}

.sheet-advantage1 {
  grid-area: advantage1;
  text-align: center;
}
.sheet-advantage2 {
  grid-area: advantage2;
  text-align: center;
}
.sheet-advantage3 {
  grid-area: advantage3;
  text-align: center;
}
.sheet-extra1-1 {
  grid-area: extra1-1;
}
.sheet-extra1-2 {
  grid-area: extra1-2 ;
}
.sheet-extra1-3 {
  grid-area: extra1-3;
}
.sheet-extra2-1 {
  grid-area: extra2-1;
  text-align: center;
}
.sheet-extra2-2 {
  grid-area: extra2-2;
  text-align: center;
}
.sheet-extra2-3 {
  grid-area: extra2-3;
  text-align: center;
}
.sheet-extra3-1 {
  grid-area: extra3-1;
}
.sheet-extra3-2 {
  grid-area: extra3-2;
}
.sheet-extra3-3 {
  grid-area: extra3-3;
}

.sheet-break-line {
  height: 2px;
  border-width: 0;
  color: gray;
  background-color: gray;
  width: 60%
}

.sheet-dotrow {
  display: grid;
  grid-template-columns: 2fr 3fr;
  grid-gap: 5px;
  justify-content: center;
  align-items: center;
  justify-items: stretch;
  padding: 2px 0 2px 2px;
}

.sheet-willpower {
  margin: auto;
  width: fit-content;
  display: grid;
  grid-template-columns: auto 32px;
  grid-gap: 1px;
}

.sheet-willpower-pool {
  display: grid;
  grid-template-rows: repeat(2, 15px);
  grid-gap: 1px;
}

.sheet-two_col_header {
  display: grid;
  grid-template-columns: auto auto;
  justify-content: center;
  grid-gap: 10px;
}

.sheet-dotrow > label {
  padding: 10px 0 0 0;
  width: 100%;
}

.sheet-dotrow > input[type="text"] {
  padding: 3px 0 0 0;
  width: 100%;
}

.sheet-list > input[type="text"] {
  width: 90%;
}

.sheet-dotrow > label > input[type="text"] {
  padding: 3px 0 0 0;
  width: 100%;
}

.sheet-textbox {
  display: grid;
  grid-template-rows: repeat(2, fit-content);
  grid-template-columns: 1fr;
  justify-content: center;
  text-align: center;
  padding-top: 5px;
}

.sheet-textbox > label {
  font-weight: bold;
  text-align: center;
}

.sheet-textbox > textarea {
  width: 90%;
  justify-self: center;
}

.sheet-dotline10 {
  margin: auto;
  display: grid;
  grid-template-columns: repeat(10, 15px);
  grid-gap: 1px;
}

.sheet-dotline11 {
  margin: auto;
  display: grid;
  grid-template-columns: repeat(11, 15px);
  grid-gap: 1px;
}

.sheet-dotline12 {
  margin: auto;
  display: grid;
  grid-template-columns: repeat(12, 15px);
  grid-gap: 1px;
}

.sheet-numberrow {
  display: grid;
  grid-template-columns: minmax(105px, auto) auto;
  justify-content: center;
  align-items: stretch;
}

.sheet-list {
  display: grid;
  grid-template-columns: 1fr;
  justify-content: center;
  align-items: stretch;
}

.sheet-numberrow > label {
  padding: 2px 0 2px 0;
}

.sheet-numberrow > input {
  margin: 2px 0 2px 0;
  justify-self: center;
}

.sheet-healthrow {
  display: grid;
  grid-template-columns: 1fr 10px 40px;
  grid-gap: 20px;
  justify-content: center;
  text-align: left;
  padding: 5px 0 5px 0;
}

.sheet-healthrow > select {
  width: fit-content;
}

.sheet-dicepool {
  display: grid;
  grid-template-columns: 18px repeat(2, 1fr) 32px;
  grid-gap: 2px;
  justify-content: center;
  padding: 5px 0 5px 0;
}

.sheet-dicepool > select {
  width: 80%;
  justify-self: center;
}

.sheet-experience {
  justify-content: center;
  display: grid;
  grid-template-rows: repeat(4, fit-content);
  text-align: center;
}

/* Hide actual dot/checkbox */
input[type="radio"],
input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 15px;
  cursor: pointer;
  z-index: 1;
  margin-top: 6px;
}

/* Styles common to fake dot and checkbox */
input[type="radio"] + span::before,
input[type="checkbox"] + span::before {
  border: solid 1px #a8a8a8;
  line-height: 14px;
  text-align: middle;
  display: inline-block;
  vertical-align: middle;
  -moz-box-shadow: 0 0 2px #ccc;
  -webkit-box-shadow: 0 0 2px #ccc;
  box-shadow: 0 0 2px #ccc;
  background: #f6f6f6;
  background: -moz-radial-gradient(#f6f6f6, #dfdfdf);
  background: -webkit-radial-gradient(#f6f6f6, #dfdfdf);
  background: -ms-radial-gradient(#f6f6f6, #dfdfdf);
  background: -o-radial-gradient(#f6f6f6, #dfdfdf);
  background: radial-gradient(#f6f6f6, #dfdfdf);
}

/* Styles unique to fake dot (checked or left of checked) */
input[type="radio"] + span::before {
  content: "•";
  width: 12px;
  height: 12px;
  font-size: 36px;
  -moz-border-radius: 50%;
  -webkit-border-radius: 50%;
  border-radius: 50%;
}

/* Styles unique to fake checkbox (unchecked) */
input[type="checkbox"] + span::before {
  position: relative;
  content: "";
  opacity: 0.25;
  width: 14px;
  height: 14px;
  font-size: 12px;
  -moz-border-radius: 3px;
  -webkit-border-radius: 3px;
  border-radius: 3px;
}

input[type="radio"].sheet-used + span::before {
  content: "✖";
  width: 12px;
  height: 12px;
  font-size: 12px;
  -moz-border-radius: 0%;
  -webkit-border-radius: 0%;
  border-radius: 0%;
}

input.sheet-zero + span::before {
  font-size: 12px;
  content: "✖";
  opacity: 0.25;
}

input.sheet-DP1Spec + span::before,
input.sheet-DP2Spec + span::before,
input.sheet-DP3Spec + span::before,
input.sheet-DP4Spec + span::before,
input.sheet-DP5Spec + span::before {
  opacity: 1;
  margin-bottom: 10px;
}

input.sheet-zero:checked + span::before {
  opacity: 0;
}

input.sheet-zero:hover + span::before {
  opacity: 1;
}

/* Styles unique to fake checkbox (checked) */
input[type="checkbox"]:checked + span::before {
  content: "✖";
  color: #a00;
  -moz-box-shadow: 0 0 2px transparent;
  -webkit-box-shadow: 0 0 2px transparent;
  box-shadow: 0 0 2px transparent;
}

/* Remove dot from all radios _after_ selected one */
input[type="radio"]:checked ~ input[type="radio"] + span::before {
  content: "";
}

div.sheet-DP,
div.sheet-DP1,
div.sheet-DP2,
div.sheet-DP3,
div.sheet-DP4,
div.sheet-DP5 {
  display: inline;
}

input.sheet-DPSpec[type="checkbox"] + span::before {
  position: relative;
  content: "";
  opacity: 1;
  width: 14px;
  height: 14px;
  font-size: 12px;
  -moz-border-radius: 3px;
  -webkit-border-radius: 3px;
  border-radius: 3px;
}

input.sheet-DPSpec[type="checkbox"]:checked + span::before {
  content: "✖";
  color: #a00;
  -moz-box-shadow: 0 0 2px transparent;
  -webkit-box-shadow: 0 0 2px transparent;
  box-shadow: 0 0 2px transparent;
}

input.sheet-DPSpec ~ button.sheet-nospec,
input.sheet-DP1Spec ~ button.sheet-nospec,
input.sheet-DP2Spec ~ button.sheet-nospec,
input.sheet-DP3Spec ~ button.sheet-nospec,
input.sheet-DP4Spec ~ button.sheet-nospec,
input.sheet-DP5Spec ~ button.sheet-nospec {
  display: inline;
}

input.sheet-DPSpec ~ button.sheet-spec,
input.sheet-DP1Spec ~ button.sheet-spec,
input.sheet-DP2Spec ~ button.sheet-spec,
input.sheet-DP3Spec ~ button.sheet-spec,
input.sheet-DP4Spec ~ button.sheet-spec,
input.sheet-DP5Spec ~ button.sheet-spec {
  display: none;
}

input.sheet-DPSpec:checked ~ button.sheet-nospec,
input.sheet-DP1Spec:checked ~ button.sheet-nospec,
input.sheet-DP2Spec:checked ~ button.sheet-nospec,
input.sheet-DP3Spec:checked ~ button.sheet-nospec,
input.sheet-DP4Spec:checked ~ button.sheet-nospec,
input.sheet-DP5Spec:checked ~ button.sheet-nospec {
  display: none;
}

input.sheet-DPSpec:checked ~ button.sheet-spec,
input.sheet-DP1Spec:checked ~ button.sheet-spec,
input.sheet-DP2Spec:checked ~ button.sheet-spec,
input.sheet-DP3Spec:checked ~ button.sheet-spec,
input.sheet-DP4Spec:checked ~ button.sheet-spec,
input.sheet-DP5Spec:checked ~ button.sheet-spec {
  display: inline;
}


text:
'use strict';

var fs = require('fs');

/**
 * A readable source for content that doesn't do dependency resolution, but
 * simply reads files and pushes them onto a stream.
 *
 * If an array of strings is provided as input to this method, then
 * they will be treated as filenames and read into the stream.
 *
 * If an array of objects is provided, then we assume that they are valid
 * objects with `source` and `file` properties, and don't use the filesystem
 * at all. This is one way of getting documentation.js to run in a browser
 * or without fs access.
 *
 * @param {Array<string|Object>} indexes entry points
 * @param {Object} options parsing options
 * @param {Function} callback called with (err, inputs)
 * @return {undefined} calls callback
 */
module.exports = function (indexes, options, callback) {
  return callback(null, indexes.map(function (index) {
    if (typeof index === 'string') {
      return {
        source: fs.readFileSync(index, 'utf8'),
        file: index
      };
    }
    return index;
  }));
};


text:
namespace iadip {
    partial class ShowEstematedResult {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing) {
            if (disposing && (components != null)) {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent() {
            this.gridResultCluster = new System.Windows.Forms.DataGridView();
            this.tbResult = new System.Windows.Forms.TextBox();
            ((System.ComponentModel.ISupportInitialize)(this.gridResultCluster)).BeginInit();
            this.SuspendLayout();
            //
            // gridResultCluster
            //
            this.gridResultCluster.AllowUserToAddRows = false;
            this.gridResultCluster.AllowUserToDeleteRows = false;
            this.gridResultCluster.AllowUserToResizeColumns = false;
            this.gridResultCluster.AllowUserToResizeRows = false;
            this.gridResultCluster.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
            this.gridResultCluster.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
            this.gridResultCluster.Dock = System.Windows.Forms.DockStyle.Top;
            this.gridResultCluster.Location = new System.Drawing.Point(0, 0);
            this.gridResultCluster.Name = "gridResultCluster";
            this.gridResultCluster.ReadOnly = true;
            this.gridResultCluster.RowHeadersVisible = false;
            this.gridResultCluster.Size = new System.Drawing.Size(771, 44);
            this.gridResultCluster.TabIndex = 0;
            //
            // tbResult
            //
            this.tbResult.BackColor = System.Drawing.SystemColors.ControlLightLight;
            this.tbResult.Dock = System.Windows.Forms.DockStyle.Fill;
            this.tbResult.Font = new System.Drawing.Font("Consolas", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
            this.tbResult.ForeColor = System.Drawing.Color.Black;
            this.tbResult.Location = new System.Drawing.Point(0, 44);
            this.tbResult.Multiline = true;
            this.tbResult.Name = "tbResult";
            this.tbResult.ReadOnly = true;
            this.tbResult.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
            this.tbResult.Size = new System.Drawing.Size(771, 226);
            this.tbResult.TabIndex = 1;
            //
            // ShowEstematedResult
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(771, 270);
            this.Controls.Add(this.tbResult);
            this.Controls.Add(this.gridResultCluster);
            this.Name = "ShowEstematedResult";
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
            this.Text = "Результат";
            ((System.ComponentModel.ISupportInitialize)(this.gridResultCluster)).EndInit();
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.DataGridView gridResultCluster;
        private System.Windows.Forms.TextBox tbResult;
    }
}


text:
package org.sagebionetworks.repo.manager.config;

import org.apache.velocity.app.VelocityEngine;
import org.apache.velocity.runtime.RuntimeConstants;
import org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader;
import org.apache.velocity.runtime.resource.loader.FileResourceLoader;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class RepositoryConfiguration {

	private static final String VELOCITY_RESOURCE_LOADERS = "classpath,file";
	private static final String VELOCITY_PARAM_CLASSPATH_LOADER_CLASS = "classpath.resource.loader.class";
	private static final String VELOCITY_PARAM_FILE_LOADER_CLASS = "file.resource.loader.class";
	private static final String VELOCITY_PARAM_RUNTIME_REFERENCES_STRICT = "runtime.references.strict";

	/**
	 * @return The velocity engine instance that can be used within the managers
	 */
	@Bean
	public VelocityEngine velocityEngine() {
		VelocityEngine engine = new VelocityEngine();
		engine.setProperty(RuntimeConstants.RESOURCE_LOADER, VELOCITY_RESOURCE_LOADERS);
		engine.setProperty(VELOCITY_PARAM_CLASSPATH_LOADER_CLASS, ClasspathResourceLoader.class.getName());
		engine.setProperty(VELOCITY_PARAM_FILE_LOADER_CLASS, FileResourceLoader.class.getName());
		engine.setProperty(VELOCITY_PARAM_RUNTIME_REFERENCES_STRICT, true);
		return engine;
	}
}


text:
package org.apache.skywalking.apm.plugin.elasticsearch.v6.define;

import static net.bytebuddy.matcher.ElementMatchers.named;
import static org.apache.skywalking.apm.agent.core.plugin.match.NameMatch.byName;

import net.bytebuddy.description.method.MethodDescription;
import net.bytebuddy.matcher.ElementMatcher;
import org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint;
import org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint;
import org.apache.skywalking.apm.agent.core.plugin.interceptor.StaticMethodsInterceptPoint;
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassEnhancePluginDefine;
import org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch;
import org.apache.skywalking.apm.plugin.elasticsearch.v6.interceptor.Constants;

public class ClusterClientInstrumentation extends ClassEnhancePluginDefine {

    public static final String ENHANCE_CLASS = "org.elasticsearch.client.ClusterClient";

    @Override
    protected ClassMatch enhanceClass() {
        return byName(ENHANCE_CLASS);
    }

    @Override
    public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
        return new ConstructorInterceptPoint[0];
    }

    @Override
    public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
        return new InstanceMethodsInterceptPoint[] {
            new InstanceMethodsInterceptPoint() {
                @Override
                public ElementMatcher<MethodDescription> getMethodsMatcher() {
                    return named("health").or(named("healthAsync"));
                }

                @Override
                public String getMethodsInterceptor() {
                    return Constants.CLUSTER_CLIENT_HEALTH_METHODS_INTERCEPTOR;
                }

                @Override
                public boolean isOverrideArgs() {
                    return false;
                }
            },
            new InstanceMethodsInterceptPoint() {
                @Override
                public ElementMatcher<MethodDescription> getMethodsMatcher() {
                    return named("getSettings").or(named("getSettingsAsync"));
                }

                @Override
                public String getMethodsInterceptor() {
                    return Constants.CLUSTER_CLIENT_GET_SETTINGS_METHODS_INTERCEPTOR;
                }

                @Override
                public boolean isOverrideArgs() {
                    return false;
                }
            },
            new InstanceMethodsInterceptPoint() {
                @Override
                public ElementMatcher<MethodDescription> getMethodsMatcher() {
                    return named("putSettings").or(named("putSettingsAsync"));
                }

                @Override
                public String getMethodsInterceptor() {
                    return Constants.CLUSTER_CLIENT_PUT_SETTINGS_METHODS_INTERCEPTOR;
                }

                @Override
                public boolean isOverrideArgs() {
                    return false;
                }
            }
        };
    }

    @Override
    public StaticMethodsInterceptPoint[] getStaticMethodsInterceptPoints() {
        return new StaticMethodsInterceptPoint[0];
    }
}


text:
#region License

#endregion
using System.Linq;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Collections.ObjectModel;
namespace System.Quality.EventSourcing
{
    /// <summary>
    /// IAggregateRootRepository
    /// </summary>
    public interface IAggregateRootRepository
    {
        TAggregateRoot GetById<TAggregateRoot>(object aggregateId, AggregateRootQueryOptions queryOptions)
            where TAggregateRoot : AggregateRoot;
        IEnumerable<TAggregateRoot> GetManyByIds<TAggregateRoot>(IEnumerable<object> aggregateIds, AggregateRootQueryOptions queryOptions)
            where TAggregateRoot : AggregateRoot;
        IEnumerable<Event> GetEventsById(object aggregateId);
        void Save(AggregateRoot aggregate);
        void Save(IEnumerable<AggregateRoot> aggregate);
        void MakeSnapshot(AggregateRoot aggregate, Func<IAggregateRootRepository, AggregateRoot, bool> predicate);
    }

    public static class IAggregateRootRepositoryExtensions
    {
        public static TAggregateRoot GetById<TAggregateRoot>(this IAggregateRootRepository repository, object aggregateId)
            where TAggregateRoot : AggregateRoot { return repository.GetById<TAggregateRoot>(aggregateId, 0); }
        public static object GetById(this IAggregateRootRepository repository, Type aggregateType, object aggregateId)
        {
            return repository.GetById<AggregateRoot>(aggregateId, 0);
        }
        public static AggregateRoot GetById(this IAggregateRootRepository repository, Type aggregateType, object aggregateId, AggregateRootQueryOptions queryOptions)
        {
            return repository.GetById<AggregateRoot>(aggregateId, queryOptions);
        }
        public static IEnumerable<AggregateRoot> GetManyByIds(this IAggregateRootRepository repository, IEnumerable<object> aggregateIds, Type aggregateType, AggregateRootQueryOptions queryOptions)
        {
            return repository.GetManyByIds<AggregateRoot>(aggregateIds, queryOptions);
        }
        public static void MakeSnapshot(this IAggregateRootRepository repository, AggregateRoot aggregate) { repository.MakeSnapshot(aggregate, null); }
    }

    /// <summary>
    /// AggregateRootRepository
    /// </summary>
    public class AggregateRootRepository : IAggregateRootRepository
    {
        private readonly IEventStore _eventStore;
        private readonly IBatchedEventStore _batchedEventStore;
        private readonly IAggregateRootSnapshotStore _snapshotStore;
        private readonly IBatchedAggregateRootSnapshotStore _batchedSnapshotStore;
        private readonly Action<IEnumerable<Event>> _eventDispatcher;
        private readonly Func<Type, AggregateRoot> _factory;

        public static class DefaultFactory
        {
            public static Func<Type, AggregateRoot> Factory = (t => (AggregateRoot)Activator.CreateInstance(t));
        }

        public AggregateRootRepository(IEventStore eventStore, IAggregateRootSnapshotStore snapshotStore)
            : this(eventStore, snapshotStore, null, DefaultFactory.Factory) { }
        public AggregateRootRepository(IEventStore eventStore, IAggregateRootSnapshotStore snapshotStore, Action<IEnumerable<Event>> eventDispatcher)
            : this(eventStore, snapshotStore, eventDispatcher, DefaultFactory.Factory) { }
        public AggregateRootRepository(IEventStore eventStore, IAggregateRootSnapshotStore snapshotStore, Action<IEnumerable<Event>> eventDispatcher, Func<Type, AggregateRoot> factory)
        {
            if (eventStore == null)
                throw new ArgumentNullException("eventStore");
            _eventStore = eventStore;
            _batchedEventStore = (eventStore as IBatchedEventStore);
            _snapshotStore = snapshotStore;
            _batchedSnapshotStore = (snapshotStore as IBatchedAggregateRootSnapshotStore);
            _eventDispatcher = eventDispatcher;
            _factory = (factory ?? DefaultFactory.Factory);
        }

        public IEnumerable<Event> GetEventsById(object aggregateId)
        {
            return _eventStore.GetEventsById(aggregateId, 0);
        }

        public TAggregateRoot GetById<TAggregateRoot>(object aggregateId, AggregateRootQueryOptions queryOptions)
             where TAggregateRoot : AggregateRoot
        {
            if (aggregateId == null)
                throw new ArgumentNullException("aggregateId");
            var aggregate = (_factory(typeof(TAggregateRoot)) as TAggregateRoot);
            if (aggregate == null)
                throw new InvalidOperationException("aggregate");
            // find snapshot
            bool loaded = false;
            AggregateRootSnapshot snapshot = null;
            if (_snapshotStore != null)
            {
                var snapshoter = (aggregate as ICanAggregateRootSnapshot);
                if ((snapshoter != null) && ((snapshot = _snapshotStore.GetLatestSnapshot<TAggregateRoot>(aggregateId)) != null))
                {
                    loaded = true;
                    snapshoter.LoadSnapshot(snapshot);
                }
            }
            // load events
            var events = _eventStore.GetEventsById(aggregateId, (snapshot != null ? snapshot.LastEventSequence : 0));
            loaded |= ((IAccessAggregateRootState)aggregate).LoadFromHistory(events);
            return ((queryOptions & AggregateRootQueryOptions.UseNullAggregates) == 0 ? aggregate : (loaded ? aggregate : null));
        }

        public IEnumerable<TAggregateRoot> GetManyByIds<TAggregateRoot>(IEnumerable<object> aggregateIds, AggregateRootQueryOptions queryOptions)
            where TAggregateRoot : AggregateRoot
        {
            if (aggregateIds == null)
                throw new ArgumentNullException("aggregateIds");
            return aggregateIds.Select(x => GetById<TAggregateRoot>(x, queryOptions)).ToList();
        }

        public void Save(AggregateRoot aggregate)
        {
            if (aggregate == null)
                throw new ArgumentNullException("aggregate");
            var accessAggregateState = (IAccessAggregateRootState)aggregate;
            var events = accessAggregateState.GetUncommittedChanges();
            _eventStore.SaveEvents(aggregate.AggregateId, events);
            if (_eventDispatcher != null)
                _eventDispatcher(events);
            accessAggregateState.MarkChangesAsCommitted();
            Func<IAggregateRootRepository, AggregateRoot, bool> inlineSnapshotPredicate;
            if ((_snapshotStore != null) && ((inlineSnapshotPredicate = _snapshotStore.InlineSnapshotPredicate) != null) && (aggregate is ICanAggregateRootSnapshot))
                MakeSnapshot(aggregate, inlineSnapshotPredicate);
        }
        public void Save(IEnumerable<AggregateRoot> aggregates)
        {
            if (aggregates == null)
                throw new ArgumentNullException("aggregates");
            foreach (var aggregate in aggregates)
                Save(aggregate);
        }

        public void MakeSnapshot(AggregateRoot aggregate, Func<IAggregateRootRepository, AggregateRoot, bool> predicate)
        {
            if (aggregate == null)
                throw new ArgumentNullException("aggregate");
            ICanAggregateRootSnapshot snapshoter;
            if ((_snapshotStore != null) && ((snapshoter = (aggregate as ICanAggregateRootSnapshot)) != null))
            {
                if ((predicate == null) || (predicate(this, aggregate)))
                    _snapshotStore.SaveSnapshot(aggregate.GetType(), snapshoter.GetSnapshot());
            }
        }
    }
}


text:
""" passworts flask webserver"""

from flask import Flask, Response, flash, redirect, render_template, stream_with_context
from flask_wtf import FlaskForm
from wtforms import BooleanField, IntegerField
from wtforms.validators import InputRequired

import generator
from preprocess_type import integer_dict  # pylint: disable=unused-import

application = Flask("passworts")
application.config.from_object("config")

class Input(FlaskForm):
    """flask forms"""

    pw_length = IntegerField("pw_length")
    pw_count = IntegerField("pw_count", validators=[InputRequired()])
    random_lenght = BooleanField("random", default=False)

def input_check(form):
    """flask input validation"""
    input_correct = False
    while input_correct is False:
        if form.random_lenght.data is False:
            try:
                int(form.pw_length.data)
            except ValueError:
                flash("You have to enter a number")
                break
            if int(form.pw_length.data) <= 4:
                flash("It is not possible to create a password unter 5 letters!")
                break
            if int(form.pw_length.data) > 16:
                flash("It is not possible to create a password over 16 letters!")
                break
        try:
            int(form.pw_count.data)
        except ValueError:
            flash("You have to enter a number")
            break
        if int(form.pw_count.data) <= 0:
            flash("It is not possible to create no passwords!")
            break
        if int(form.pw_count.data) > 50:
            flash("It is not possible to create more than 50 passwords!")
            break
        input_correct = True
    return input_correct

@application.route("/", methods=["GET", "POST"])
def home():
    """index page"""
    form = Input()
    return render_template("index.html", title="Home", form=form)

@application.route("/result", methods=["POST"])
def result():
    """resulting page"""

    def stream_pw():
        yield render_template("result.html", title="Result")
        yield '\n
\n'
        for _i in range(pw_count):
            curr_pw = generator.generate(pw_length, random_lenght)
            # print(curr_pw)
            yield (
                f'<input class="result" type="text" value={curr_pw} readonly'
                ' onclick="this.select();">\n'
            )
        yield "
\n"
        yield "
\n"

    form = Input()
    if form.validate_on_submit():
        if input_check(form):
            random_lenght = form.random_lenght.data
            if not bool(random_lenght):
                pw_length = int(form.pw_length.data)
            else:
                pw_length = 0
            pw_count = int(form.pw_count.data)
            return Response(stream_with_context(stream_pw()))
        return redirect("/")
    return redirect("/")

@application.route("/result", methods=["GET"])
def result_get():
    """redirect get to results to index"""
    return redirect("/")

@application.errorhandler(404)
def page_not_found(_error):
    """error page display"""
    return render_template("404.html", title="Error")

if __name__ == "__main__":
    application.run()


text:
package iso

import (
	"errors"
	"io/ioutil"
	"os"
	"path"
	"testing"
)

func TestMount(t *testing.T) {
	isoMntPnt := path.Join(os.TempDir(), "iso_mnt_")
	isoFile, err := ioutil.TempFile("", "")
	if err != nil {
		t.Fatalf("setup failed: %v", err)
	}

	tests := []struct {
		desc         string
		fakeMountCmd func(string, string) error
		in           string
		out          *Handler
		err          error
	}{
		{
			desc:         "empty ISO file",
			fakeMountCmd: func(string, string) error { return nil },
			in:           "",
			out:          nil,
			err:          errInput,
		},
		{
			desc:         "bad iso path",
			fakeMountCmd: func(string, string) error { return nil },
			in:           "fake/iso/file",
			out:          nil,
			err:          errFileNotFound,
		},
		{
			desc:         "failed mount",
			fakeMountCmd: func(string, string) error { return errors.New("error") },
			in:           isoFile.Name(),
			out:          nil,
			err:          errMount,
		},
		{
			desc:         "successful mount",
			fakeMountCmd: func(string, string) error { return nil },
			in:           isoFile.Name(),
			out:          &Handler{image: isoFile.Name(), mount: isoMntPnt},
			err:          nil,
		},
	}
	for _, tt := range tests {
		mountCmd = tt.fakeMountCmd
		got, err := mount(tt.in)
		if chErr := cmpHandler(got, tt.out); chErr != nil {
			t.Errorf("%s: %v", tt.desc, chErr)
		}
		if err == tt.err {
			continue
		}
		if err == nil || tt.err == nil {
			t.Errorf("%s: unexpected nil encountered or test misconfigured, err '%v', tt.err '%v'", tt.desc, err, tt.err)
		}
		if !errors.Is(err, tt.err) {
			t.Errorf("%s: mount() err = %v, want: %v", tt.desc, err, tt.err)
		}
	}
}

func TestCopy(t *testing.T) {
	tests := []struct {
		desc        string
		fakeCopyCmd func(string, string) error
		handler     *Handler
		dest        string
		err         error
	}{
		{
			desc:        "empty source",
			fakeCopyCmd: func(string, string) error { return nil },
			handler:     &Handler{mount: ""},
			dest:        "fakeDst",
			err:         errNotMounted,
		},
		{
			desc:        "empty destination",
			fakeCopyCmd: func(string, string) error { return nil },
			handler:     &Handler{mount: "fakeSrc"},
			dest:        "",
			err:         errInput,
		},
		{
			desc:        "error from copyCmd",
			fakeCopyCmd: func(string, string) error { return errors.New("error") },
			handler:     &Handler{mount: "error"},
			dest:        "fakeDst",
			err:         errCopy,
		},
		{
			desc:        "successful copy",
			fakeCopyCmd: func(string, string) error { return nil },
			handler:     &Handler{mount: "fakeSrc"},
			dest:        "fakeDst",
			err:         nil,
		},
	}

	for _, tt := range tests {
		copyCmd = tt.fakeCopyCmd
		err := tt.handler.Copy(tt.dest)
		if err == tt.err {
			continue
		}
		if err == nil || tt.err == nil {
			t.Errorf("%s: unexpected nil encountered or test misconfigured, err '%v', tt.err '%v'", tt.desc, err, tt.err)
		}
		if !errors.Is(err, tt.err) {
			t.Errorf("%s: Copy() err = %v, want: %v", tt.desc, err, tt.err)
		}
	}
}

func TestDismount(t *testing.T) {
	// A fake temporary directory
	fakeMount, err := ioutil.TempDir("", "dismount_test_")
	if err != nil {
		t.Fatalf("could not create fake mount directory: %v", err)
	}

	tests := []struct {
		desc            string
		fakeDismountCmd func(string) error
		handler         *Handler
		err             error
	}{
		{
			desc:            "empty mountpoint",
			fakeDismountCmd: func(string) error { return nil },
			handler:         &Handler{mount: ""},
			err:             errInput,
		},
		{
			desc:            "error from dismountCmd ",
			fakeDismountCmd: func(string) error { return errors.New("error") },
			handler:         &Handler{mount: "error"},
			err:             errDismount,
		},
		{
			desc:            "cleanup failure",
			fakeDismountCmd: func(string) error { return nil },
			handler:         &Handler{mount: "non-existent"},
			err:             errDmCleanup,
		},
		{
			desc:            "successful dismount",
			fakeDismountCmd: func(string) error { return nil },
			handler:         &Handler{mount: fakeMount},
			err:             nil,
		},
	}

	for _, tt := range tests {
		dismountCmd = tt.fakeDismountCmd
		err := tt.handler.Dismount()
		if err == tt.err {
			continue
		}
		if err == nil || tt.err == nil {
			t.Errorf("%s: unexpected nil encountered or test misconfigured, err '%v', tt.err '%v'", tt.desc, err, tt.err)
		}
		if !errors.Is(err, tt.err) {
			t.Errorf("%s: Dismount() err = %v, want: %v", tt.desc, err, tt.err)
		}
	}
}


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

package com.azure.resourcemanager.containerinstance.models;

import com.azure.core.annotation.Fluent;
import com.azure.resourcemanager.containerinstance.fluent.models.ContainerExecResponseInner;
import com.azure.resourcemanager.resources.fluentcore.model.HasInnerModel;

/** Response containing the container exec command. */
@Fluent
public interface ContainerExecResponse extends HasInnerModel<ContainerExecResponseInner> {
    /**
     * Get the webSocketUri value.
     *
     * @return the webSocketUri value
     */
    String webSocketUri();

    /**
     * Get the password value.
     *
     * @return the password value
     */
    String password();
}


text:
@interface BLJSONResponseSerializerTests : XCTestCase
{
    BLJSONResponseSerializer* _serializer;
}
@end

@implementation BLJSONResponseSerializerTests

- (void)setUp
{
    [super setUp];
    XCTAssert(_serializer = [BLJSONResponseSerializer serializer], @"Serializer failed factory method");
}

- (void)tearDown
{
    _serializer = nil;
    [super tearDown];
}

- (void)testResponseObjectForResponseEtc
{
    NSHTTPURLResponse* response = [[NSHTTPURLResponse alloc] initWithURL:[NSURL URLWithString:@"www.google.com"]
                                                              statusCode:401
                                                             HTTPVersion:@"5.0"
                                                            headerFields:@{ @"Content-Type" : @"application/json" }];

    NSData* badData = [@"IOsjdojasoidjaisjdoiajsd" dataUsingEncoding:NSUTF8StringEncoding];
    NSError* error;

    [_serializer responseObjectForResponse:response data:badData error:&error];

    XCTAssert(error, @"Failed; no error returned");
    XCTAssert(error.userInfo[kBLJSONResponseSerializerKeyRawData], @"Raw Data Dictionary Not Found. %@", error.userInfo);
    XCTAssertNil(error.userInfo[kBLJSONResponseSerializerKeyJSONData], @"JSON Found in bad data.  Unexpected.");

    error = nil;
    NSData* goodData = [@"{ \"json\" : true }" dataUsingEncoding:NSUTF8StringEncoding];

    [_serializer responseObjectForResponse:response data:goodData error:&error];

    XCTAssert(error, @"Failed; no error returned");
    XCTAssert(error.userInfo[kBLJSONResponseSerializerKeyRawData], @"Raw Data Dictionary Not Found");
    XCTAssert(error.userInfo[kBLJSONResponseSerializerKeyJSONData], @"JSON Dictionary Not Found");
}

@end


text:
    I've tried having the really simple UserControls not have a matching ViewModel, and I've _always_ been
    burned in the long run. No matter how simple and it makes it really easy to set up - just set or
    Bind the UserControl's ViewModel property to some property on your containing view's own ViewModel

    ie. `this.OneWayBind(ViewModel, vm => vm.ErrorViewModel, v => v.ErrorView.ViewModel);`

* Use Matt Oswald's user control as inspiration.
* Explain the golden rule of how to use `WhenActivated`


text:
import { mount } from 'enzyme';
import React, { memo, useContext, useRef, useState } from 'react';
import Row from '../row';
import RowContext from '../RowContext';

const CacheInner = memo(() => {
  const countRef = useRef(0);
  countRef.current++;
  useContext(RowContext);
  return (

      Child Rendering Count: {countRef.current}

  );
});

const CacheOuter = () => {
  const [count, setCount] = useState(1);
  const handleClick = () => {
    setCount(count + 1);
  };
  return (

      <button type="button" onClick={handleClick} id="parent_btn">
        Click
      </button>
      Parent Rendering Count: {count}
      <Row>
        <CacheInner />
      </Row>

  );
};

it('Cached RowContext is working', () => {
  const wrapper = mount(<CacheOuter />);
  const childCount = wrapper.find('#child_count').text();

  wrapper.find('#parent_btn').at(0).simulate('click');
  expect(wrapper.find('#parent_count').text()).toBe('2');
  // child component won't rerender
  expect(wrapper.find('#child_count').text()).toBe(childCount);

  wrapper.find('#parent_btn').at(0).simulate('click');
  expect(wrapper.find('#parent_count').text()).toBe('3');
  // child component won't rerender
  expect(wrapper.find('#child_count').text()).toBe(childCount);
});


text:
package org.springframework.cloud.stream.config;

import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Properties;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import org.springframework.beans.factory.BeanCreationException;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cloud.stream.binder.BinderType;
import org.springframework.cloud.stream.binder.BinderTypeRegistry;
import org.springframework.cloud.stream.binder.DefaultBinderTypeRegistry;
import org.springframework.cloud.stream.binding.CompositeMessageChannelConfigurer;
import org.springframework.cloud.stream.binding.MessageChannelConfigurer;
import org.springframework.cloud.stream.binding.MessageConverterConfigurer;
import org.springframework.cloud.stream.binding.MessageSourceBindingTargetFactory;
import org.springframework.cloud.stream.binding.SubscribableChannelBindingTargetFactory;
import org.springframework.cloud.stream.function.StreamFunctionProperties;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.Role;
import org.springframework.core.io.Resource;
import org.springframework.core.io.UrlResource;
import org.springframework.core.io.support.PropertiesLoaderUtils;
import org.springframework.integration.context.IntegrationContextUtils;
import org.springframework.integration.handler.support.MapArgumentResolver;
import org.springframework.integration.handler.support.PayloadExpressionArgumentResolver;
import org.springframework.integration.handler.support.PayloadsArgumentResolver;
import org.springframework.integration.support.NullAwarePayloadArgumentResolver;
import org.springframework.lang.Nullable;
import org.springframework.messaging.converter.CompositeMessageConverter;
import org.springframework.messaging.handler.annotation.support.DefaultMessageHandlerMethodFactory;
import org.springframework.messaging.handler.annotation.support.HeaderMethodArgumentResolver;
import org.springframework.messaging.handler.annotation.support.HeadersMethodArgumentResolver;
import org.springframework.messaging.handler.annotation.support.MessageHandlerMethodFactory;
import org.springframework.messaging.handler.invocation.HandlerMethodArgumentResolver;
import org.springframework.util.ClassUtils;
import org.springframework.util.StringUtils;
import org.springframework.validation.Validator;

/**
 * @author Marius Bogoevici
 * @author Ilayaperumal Gopinathan
 * @author Oleg Zhurakousky
 * @author Soby Chacko
 * @author David Harrigan
 */
@Configuration
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
@EnableConfigurationProperties({ BindingServiceProperties.class })
@Import(ContentTypeConfiguration.class)
public class BinderFactoryAutoConfiguration {

	private static final String SPRING_CLOUD_STREAM_INTERNAL_PREFIX = "spring.cloud.stream.internal";

	private static final String SELF_CONTAINED_APP_PROPERTY_NAME = SPRING_CLOUD_STREAM_INTERNAL_PREFIX
			+ ".selfContained";

	protected final Log logger = LogFactory.getLog(getClass());

	@Value("${" + SELF_CONTAINED_APP_PROPERTY_NAME + ":}")
	private String selfContained;

	static Collection<BinderType> parseBinderConfigurations(ClassLoader classLoader,
			Resource resource) throws IOException, ClassNotFoundException {
		Properties properties = PropertiesLoaderUtils.loadProperties(resource);
		Collection<BinderType> parsedBinderConfigurations = new ArrayList<>();
		for (Map.Entry<?, ?> entry : properties.entrySet()) {
			String binderType = (String) entry.getKey();
			String[] binderConfigurationClassNames = StringUtils
					.commaDelimitedListToStringArray((String) entry.getValue());
			Class<?>[] binderConfigurationClasses = new Class[binderConfigurationClassNames.length];
			int i = 0;
			for (String binderConfigurationClassName : binderConfigurationClassNames) {
				binderConfigurationClasses[i++] = ClassUtils
						.forName(binderConfigurationClassName, classLoader);
			}
			parsedBinderConfigurations
					.add(new BinderType(binderType, binderConfigurationClasses));
		}
		return parsedBinderConfigurations;
	}

	@Bean(IntegrationContextUtils.MESSAGE_HANDLER_FACTORY_BEAN_NAME)
	public static MessageHandlerMethodFactory messageHandlerMethodFactory(
			@Qualifier(IntegrationContextUtils.ARGUMENT_RESOLVER_MESSAGE_CONVERTER_BEAN_NAME) CompositeMessageConverter compositeMessageConverter,
			@Nullable Validator validator, ConfigurableListableBeanFactory clbf) {

		DefaultMessageHandlerMethodFactory messageHandlerMethodFactory = new DefaultMessageHandlerMethodFactory();
		messageHandlerMethodFactory.setMessageConverter(compositeMessageConverter);

		/*
		 * We essentially do the same thing as the
		 * DefaultMessageHandlerMethodFactory.initArgumentResolvers(..). We can't do it as
		 * custom resolvers for two reasons. 1. We would have two duplicate (compatible)
		 * resolvers, so they would need to be ordered properly to ensure these new
		 * resolvers take precedence. 2.
		 * DefaultMessageHandlerMethodFactory.initArgumentResolvers(..) puts
		 * MessageMethodArgumentResolver before custom converters thus not allowing an
		 * override which kind of proves #1.
		 *
		 * In all, all this will be obsolete once https://jira.spring.io/browse/SPR-17503
		 * is addressed and we can fall back on core resolvers
		 */
		List<HandlerMethodArgumentResolver> resolvers = new LinkedList<>();
		resolvers.add(new SmartPayloadArgumentResolver(
				compositeMessageConverter,
				validator));
		resolvers.add(new SmartMessageMethodArgumentResolver(
				compositeMessageConverter));

		resolvers.add(new HeaderMethodArgumentResolver(clbf.getConversionService(), clbf));
		resolvers.add(new HeadersMethodArgumentResolver());

		// Copy the order from Spring Integration for compatibility with SI 5.2
		resolvers.add(new PayloadExpressionArgumentResolver());
		resolvers.add(new NullAwarePayloadArgumentResolver(compositeMessageConverter));
		PayloadExpressionArgumentResolver payloadExpressionArgumentResolver = new PayloadExpressionArgumentResolver();
		payloadExpressionArgumentResolver.setBeanFactory(clbf);
		resolvers.add(payloadExpressionArgumentResolver);
		PayloadsArgumentResolver payloadsArgumentResolver = new PayloadsArgumentResolver();
		payloadsArgumentResolver.setBeanFactory(clbf);
		resolvers.add(payloadsArgumentResolver);
		MapArgumentResolver mapArgumentResolver = new MapArgumentResolver();
		mapArgumentResolver.setBeanFactory(clbf);
		resolvers.add(mapArgumentResolver);

		messageHandlerMethodFactory.setArgumentResolvers(resolvers);
		messageHandlerMethodFactory.setValidator(validator);
		return messageHandlerMethodFactory;
	}

	@Bean
	public BinderTypeRegistry binderTypeRegistry(
			ConfigurableApplicationContext configurableApplicationContext) {
		Map<String, BinderType> binderTypes = new HashMap<>();
		ClassLoader classLoader = configurableApplicationContext.getClassLoader();
		try {
			Enumeration<URL> resources = classLoader.getResources("META-INF/spring.binders");
			// see if test binder is available on the classpath and if so add it to the binderTypes
			try {
				BinderType bt = new BinderType("integration", new Class[] {
						classLoader.loadClass("org.springframework.cloud.stream.binder.test.TestChannelBinderConfiguration")});
				binderTypes.put("integration", bt);
			}
			catch (Exception e) {
				// ignore. means test binder is not available
			}

			if (binderTypes.isEmpty() && !Boolean.valueOf(this.selfContained)
					&& (resources == null || !resources.hasMoreElements())) {
				this.logger.debug(
						"Failed to locate 'META-INF/spring.binders' resources on the classpath."
								+ " Assuming standard boot 'META-INF/spring.factories' configuration is used");
			}
			else {
				while (resources.hasMoreElements()) {
					URL url = resources.nextElement();
					UrlResource resource = new UrlResource(url);
					for (BinderType binderType : parseBinderConfigurations(classLoader, resource)) {
						binderTypes.put(binderType.getDefaultName(), binderType);
					}
				}
			}

		}
		catch (IOException | ClassNotFoundException e) {
			throw new BeanCreationException("Cannot create binder factory:", e);
		}
		return new DefaultBinderTypeRegistry(binderTypes);
	}

	@Bean
	public MessageConverterConfigurer messageConverterConfigurer(
			BindingServiceProperties bindingServiceProperties,
			@Qualifier(IntegrationContextUtils.ARGUMENT_RESOLVER_MESSAGE_CONVERTER_BEAN_NAME) CompositeMessageConverter compositeMessageConverter,
			@Nullable StreamFunctionProperties streamFunctionProperties) {

		return new MessageConverterConfigurer(bindingServiceProperties, compositeMessageConverter, streamFunctionProperties);
	}

	@Bean
	public SubscribableChannelBindingTargetFactory channelFactory(
			CompositeMessageChannelConfigurer compositeMessageChannelConfigurer) {
		return new SubscribableChannelBindingTargetFactory(
				compositeMessageChannelConfigurer);
	}

	@Bean
	public MessageSourceBindingTargetFactory messageSourceFactory(
			@Qualifier(IntegrationContextUtils.ARGUMENT_RESOLVER_MESSAGE_CONVERTER_BEAN_NAME) CompositeMessageConverter compositeMessageConverter,
			CompositeMessageChannelConfigurer compositeMessageChannelConfigurer) {
		return new MessageSourceBindingTargetFactory(compositeMessageConverter,
				compositeMessageChannelConfigurer);
	}

	@Bean
	public CompositeMessageChannelConfigurer compositeMessageChannelConfigurer(
			MessageConverterConfigurer messageConverterConfigurer) {
		List<MessageChannelConfigurer> configurerList = new ArrayList<>();
		configurerList.add(messageConverterConfigurer);
		return new CompositeMessageChannelConfigurer(configurerList);
	}

}


text:
package org.apache.drill;

import org.apache.drill.common.exceptions.UserException;
import org.apache.drill.common.types.TypeProtos;
import org.apache.drill.common.util.TestTools;
import org.junit.Test;

public class TestStarQueries extends BaseTestQuery{
  static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(TestStarQueries.class);
  static final String WORKING_PATH = TestTools.getWorkingPath();
  static final String TEST_RES_PATH = WORKING_PATH + "/src/test/resources";

  @Test // see DRILL-2021
  public void testSelStarCommaSameColumnRepeated() throws Exception {
    testBuilder()
      .sqlQuery("select n_name, *, n_name, n_name from cp.`tpch/nation.parquet`")
      .ordered()
      .csvBaselineFile("testframework/testStarQueries/testSelStarCommaSameColumnRepeated/q1.tsv")
      .baselineTypes(TypeProtos.MinorType.VARCHAR, TypeProtos.MinorType.INT, TypeProtos.MinorType.VARCHAR, TypeProtos.MinorType.INT, TypeProtos.MinorType.VARCHAR, TypeProtos.MinorType.VARCHAR, TypeProtos.MinorType.VARCHAR)
      .baselineColumns("n_name", "n_nationkey", "n_name0", "n_regionkey", "n_comment", "n_name00", "n_name1")
      .build().run();

    testBuilder()
      .sqlQuery("select n_name, *, n_name, n_name from cp.`tpch/nation.parquet` limit 2")
      .ordered()
      .csvBaselineFile("testframework/testStarQueries/testSelStarCommaSameColumnRepeated/q2.tsv")
      .baselineTypes(TypeProtos.MinorType.VARCHAR, TypeProtos.MinorType.INT, TypeProtos.MinorType.VARCHAR, TypeProtos.MinorType.INT, TypeProtos.MinorType.VARCHAR, TypeProtos.MinorType.VARCHAR, TypeProtos.MinorType.VARCHAR)
      .baselineColumns("n_name", "n_nationkey", "n_name0", "n_regionkey", "n_comment", "n_name00", "n_name1")
      .build().run();

    testBuilder()
      .sqlQuery("select *, n_name, *, n_name, n_name from cp.`tpch/nation.parquet`")
      .ordered()
      .csvBaselineFile("testframework/testStarQueries/testSelStarCommaSameColumnRepeated/q3.tsv")
      .baselineTypes(TypeProtos.MinorType.INT, TypeProtos.MinorType.VARCHAR, TypeProtos.MinorType.INT, TypeProtos.MinorType.VARCHAR, TypeProtos.MinorType.VARCHAR,
            TypeProtos.MinorType.INT, TypeProtos.MinorType.VARCHAR, TypeProtos.MinorType.INT, TypeProtos.MinorType.VARCHAR, TypeProtos.MinorType.VARCHAR, TypeProtos.MinorType.VARCHAR)
      .baselineColumns("n_nationkey", "n_name", "n_regionkey", "n_comment", "n_name0",
            "n_nationkey0", "n_name1", "n_regionkey0", "n_comment0", "n_name00", "n_name10")
      .build().run();

    testBuilder()
      .sqlQuery("select *, n_name, *, n_name, n_name from cp.`tpch/nation.parquet` limit 2")
      .ordered()
      .csvBaselineFile("testframework/testStarQueries/testSelStarCommaSameColumnRepeated/q4.tsv")
      .baselineTypes(TypeProtos.MinorType.INT, TypeProtos.MinorType.VARCHAR, TypeProtos.MinorType.INT, TypeProtos.MinorType.VARCHAR, TypeProtos.MinorType.VARCHAR,
            TypeProtos.MinorType.INT, TypeProtos.MinorType.VARCHAR, TypeProtos.MinorType.INT, TypeProtos.MinorType.VARCHAR, TypeProtos.MinorType.VARCHAR, TypeProtos.MinorType.VARCHAR)
      .baselineColumns("n_nationkey", "n_name", "n_regionkey", "n_comment", "n_name0",
            "n_nationkey0", "n_name1", "n_regionkey0", "n_comment0", "n_name00", "n_name10")
      .build().run();
  }

  @Test // see DRILL-1979
  public void testSelStarMultipleStarsRegularColumnAsAlias() throws Exception {
    testBuilder()
      .sqlQuery("select *, n_name as extra, *, n_name as extra from cp.`tpch/nation.parquet`")
      .ordered()
      .csvBaselineFile("testframework/testStarQueries/testSelStarMultipleStarsRegularColumnAsAlias/q1.tsv")
      .baselineTypes(TypeProtos.MinorType.INT, TypeProtos.MinorType.VARCHAR, TypeProtos.MinorType.INT, TypeProtos.MinorType.VARCHAR, TypeProtos.MinorType.VARCHAR,
              TypeProtos.MinorType.INT, TypeProtos.MinorType.VARCHAR, TypeProtos.MinorType.INT, TypeProtos.MinorType.VARCHAR, TypeProtos.MinorType.VARCHAR)
      .baselineColumns("n_nationkey", "n_name", "n_regionkey", "n_comment", "extra", "n_nationkey0", "n_name0", "n_regionkey0", "n_comment0", "extra0")
      .build().run();

      testBuilder()
      .sqlQuery("select *, n_name as extra, *, n_name as extra from cp.`tpch/nation.parquet` limit 2")
      .ordered()
      .csvBaselineFile("testframework/testStarQueries/testSelStarMultipleStarsRegularColumnAsAlias/q2.tsv")
      .baselineTypes(TypeProtos.MinorType.INT, TypeProtos.MinorType.VARCHAR, TypeProtos.MinorType.INT, TypeProtos.MinorType.VARCHAR, TypeProtos.MinorType.VARCHAR,
              TypeProtos.MinorType.INT, TypeProtos.MinorType.VARCHAR, TypeProtos.MinorType.INT, TypeProtos.MinorType.VARCHAR, TypeProtos.MinorType.VARCHAR)
      .baselineColumns("n_nationkey", "n_name", "n_regionkey", "n_comment", "extra", "n_nationkey0", "n_name0", "n_regionkey0", "n_comment0", "extra0")
      .build().run();
  }

  @Test // see DRILL-1828
  public void testSelStarMultipleStars() throws Exception {
    testBuilder()
    .sqlQuery("select *, *, n_name from cp.`tpch/nation.parquet`")
    .ordered()
    .csvBaselineFile("testframework/testStarQueries/testSelStarMultipleStars/q1.tsv")
    .baselineTypes(TypeProtos.MinorType.INT, TypeProtos.MinorType.VARCHAR, TypeProtos.MinorType.INT, TypeProtos.MinorType.VARCHAR, TypeProtos.MinorType.INT, TypeProtos.MinorType.VARCHAR, TypeProtos.MinorType.INT, TypeProtos.MinorType.VARCHAR, TypeProtos.MinorType.VARCHAR)
    .baselineColumns("n_nationkey", "n_name", "n_regionkey", "n_comment", "n_nationkey0", "n_name0", "n_regionkey0", "n_comment0", "n_name1")
    .build().run();

    testBuilder()
    .sqlQuery("select *, *, n_name from cp.`tpch/nation.parquet` limit 2")
    .ordered()
    .csvBaselineFile("testframework/testStarQueries/testSelStarMultipleStars/q2.tsv")
    .baselineTypes(TypeProtos.MinorType.INT, TypeProtos.MinorType.VARCHAR, TypeProtos.MinorType.INT, TypeProtos.MinorType.VARCHAR, TypeProtos.MinorType.INT, TypeProtos.MinorType.VARCHAR, TypeProtos.MinorType.INT, TypeProtos.MinorType.VARCHAR, TypeProtos.MinorType.VARCHAR)
    .baselineColumns("n_nationkey", "n_name", "n_regionkey", "n_comment", "n_nationkey0", "n_name0", "n_regionkey0", "n_comment0", "n_name1")
    .build().run();
  }

  @Test // see DRILL-1825
  public void testSelStarWithAdditionalColumnLimit() throws Exception {
    testBuilder()
    .sqlQuery("select *, n_nationkey, *, n_name from cp.`tpch/nation.parquet` limit 2")
    .ordered()
    .csvBaselineFile("testframework/testStarQueries/testSelStarWithAdditionalColumnLimit/q1.tsv")
    .baselineTypes(TypeProtos.MinorType.INT, TypeProtos.MinorType.VARCHAR, TypeProtos.MinorType.INT, TypeProtos.MinorType.VARCHAR, TypeProtos.MinorType.INT, TypeProtos.MinorType.INT, TypeProtos.MinorType.VARCHAR, TypeProtos.MinorType.INT, TypeProtos.MinorType.VARCHAR, TypeProtos.MinorType.VARCHAR)
    .baselineColumns("n_nationkey", "n_name", "n_regionkey", "n_comment", "n_nationkey0", "n_nationkey1", "n_name0", "n_regionkey0", "n_comment0", "n_name1")
    .build().run();
  }

  @Test
  public void testSelStarOrderBy() throws Exception{
    testBuilder()
        .ordered()
        .sqlQuery(" select * from cp.`employee.json` order by last_name")
        .sqlBaselineQuery(" select employee_id, full_name,first_name,last_name,position_id,position_title,store_id," +
            " department_id,birth_date,hire_date,salary,supervisor_id,education_level,marital_status,gender,management_role " +
            " from cp.`employee.json` " +
            " order by last_name ")
        .build().run();

  }

  @Test
  public void testSelStarOrderByLimit() throws Exception{
    testBuilder()
        .ordered()
        .sqlQuery(" select * from cp.`employee.json` order by last_name limit 2")
        .sqlBaselineQuery(" select employee_id, full_name,first_name,last_name,position_id,position_title,store_id," +
            " department_id,birth_date,hire_date,salary,supervisor_id,education_level,marital_status,gender,management_role " +
            " from cp.`employee.json` " +
            " order by last_name limit 2")
        .build().run();

  }

  @Test
  public void testSelStarPlusRegCol() throws Exception{
    testBuilder()
        .unOrdered()
        .sqlQuery("select *, n_nationkey as key2 from cp.`tpch/nation.parquet` order by n_name limit 2")
        .sqlBaselineQuery("select n_comment, n_name, n_nationkey, n_regionkey, n_nationkey as key2 from cp.`tpch/nation.parquet` order by n_name limit 2")
        .build().run();

  }

  @Test
  public void testSelStarWhereOrderBy() throws Exception{
    testBuilder()
        .ordered()
        .sqlQuery("select * from cp.`employee.json` where first_name = 'James' order by last_name")
        .sqlBaselineQuery("select employee_id, full_name,first_name,last_name,position_id,position_title,store_id," +
            " department_id,birth_date,hire_date,salary,supervisor_id,education_level,marital_status,gender,management_role " +
            " from cp.`employee.json` " +
            " where first_name = 'James' order by last_name")
        .build().run();

  }

  @Test
  public void testSelStarJoin() throws Exception {
    testBuilder()
        .ordered()
        .sqlQuery("select * from cp.`tpch/nation.parquet` n, cp.`tpch/region.parquet` r where n.n_regionkey = r.r_regionkey order by n.n_name")
        .sqlBaselineQuery("select n.n_nationkey, n.n_name,n.n_regionkey,n.n_comment,r.r_regionkey,r.r_name, r.r_comment from cp.`tpch/nation.parquet` n, cp.`tpch/region.parquet` r where n.n_regionkey = r.r_regionkey order by n.n_name")
        .build().run();

  }

  @Test
  public void testSelLeftStarJoin() throws Exception {
    testBuilder()
        .ordered()
        .sqlQuery("select n.* from cp.`tpch/nation.parquet` n, cp.`tpch/region.parquet` r where n.n_regionkey = r.r_regionkey order by n.n_name")
        .sqlBaselineQuery("select n.n_nationkey, n.n_name, n.n_regionkey, n.n_comment from cp.`tpch/nation.parquet` n, cp.`tpch/region.parquet` r where n.n_regionkey = r.r_regionkey order by n.n_name")
        .build().run();

  }

  @Test
  public void testSelRightStarJoin() throws Exception {
    testBuilder()
        .ordered()
        .sqlQuery("select r.* from cp.`tpch/nation.parquet` n, cp.`tpch/region.parquet` r where n.n_regionkey = r.r_regionkey order by n.n_name")
        .sqlBaselineQuery("select r.r_regionkey, r.r_name, r.r_comment from cp.`tpch/nation.parquet` n, cp.`tpch/region.parquet` r where n.n_regionkey = r.r_regionkey order by n.n_name")
        .build().run();

  }

  @Test
  public void testSelStarRegColConstJoin() throws Exception {
    testBuilder()
        .ordered()
        .sqlQuery("select *, n.n_nationkey as n_nationkey0, 1 + 2 as constant from cp.`tpch/nation.parquet` n, cp.`tpch/region.parquet` r where n.n_regionkey = r.r_regionkey order by n.n_name")
        .sqlBaselineQuery(" select n.n_nationkey, n.n_name, n.n_regionkey, n.n_comment, r.r_regionkey, r.r_name, r.r_comment, " +
            " n.n_nationkey as n_nationkey0, 1 + 2 as constant " +
            " from cp.`tpch/nation.parquet` n, cp.`tpch/region.parquet` r " +
            " where n.n_regionkey = r.r_regionkey " +
            " order by n.n_name")
        .build().run();

  }

  @Test
  public void testSelStarBothSideJoin() throws Exception {
    testBuilder()
        .unOrdered()
        .sqlQuery("select n.*, r.* from cp.`tpch/nation.parquet` n, cp.`tpch/region.parquet` r where n.n_regionkey = r.r_regionkey")
        .sqlBaselineQuery("select n.n_nationkey,n.n_name,n.n_regionkey,n.n_comment,r.r_regionkey,r.r_name,r.r_comment from cp.`tpch/nation.parquet` n, cp.`tpch/region.parquet` r where n.n_regionkey = r.r_regionkey order by n.n_name")
        .build().run();

  }

  @Test
  public void testSelStarJoinSameColName() throws Exception {
    testBuilder()
        .unOrdered()
        .sqlQuery("select * from cp.`tpch/nation.parquet` n1, cp.`tpch/nation.parquet` n2 where n1.n_nationkey = n2.n_nationkey")
        .sqlBaselineQuery("select n1.n_nationkey,n1.n_name,n1.n_regionkey,n1.n_comment,n2.n_nationkey,n2.n_name,n2.n_regionkey, n2.n_comment " +
            "from cp.`tpch/nation.parquet` n1, cp.`tpch/nation.parquet` n2 where n1.n_nationkey = n2.n_nationkey")
        .build().run();

  }

  @Test // DRILL-1293
  public void testStarView1() throws Exception {
    test("use dfs_test.tmp");
    test("create view vt1 as select * from cp.`tpch/region.parquet` r, cp.`tpch/nation.parquet` n where r.r_regionkey = n.n_regionkey");
    test("select * from vt1");
    test("drop view vt1");
  }

  @Test  // select star for a SchemaTable.
  public void testSelStarSubQSchemaTable() throws Exception {
    test("select name, kind, type from (select * from sys.options);");
  }

  @Test  // Join a select star of SchemaTable, with a select star of Schema-less table.
  public void testSelStarJoinSchemaWithSchemaLess() throws Exception {
    String query = "select t1.name, t1.kind, t2.n_nationkey from " +
        "(select * from sys.options) t1 " +
        "join (select * from cp.`tpch/nation.parquet`) t2 " +
        "on t1.name = t2.n_name";

    test("alter session set `planner.enable_broadcast_join` = false");
    test(query);
    test("alter session set `planner.enable_broadcast_join` = true");
    test(query);
  }

  @Test // see DRILL-1811
  public void testSelStarDifferentColumnOrder() throws Exception {
    test("select first_name, * from cp.`employee.json`;");
    test("select *, first_name, *, last_name from cp.`employee.json`;");
  }

  @Test(expected = UserException.class)  // Should get "At line 1, column 8: Column 'n_nationkey' is ambiguous"
  public void testSelStarAmbiguousJoin() throws Exception {
    try {
      test("select x.n_nationkey, x.n_name, x.n_regionkey, x.r_name from (select * from cp.`tpch/nation.parquet` n, cp.`tpch/region.parquet` r where n.n_regionkey = r.r_regionkey) x " ) ;
    } catch (UserException e) {
      logger.info("***** Test resulted in expected failure: " + e.getMessage());
      throw e;
    }
  }

  @Test
  public void testSelStarSubQJson2() throws Exception {
    test("select v.first_name from (select * from cp.`employee.json`) v limit 2" );
  }

  // Select * in SubQuery,  View  or CTE (With clause)
  @Test  // Select * in SubQuery : regular columns appear in select clause, where, group by, order by.
  public void testSelStarSubQPrefix() throws Exception {
    test("select t.n_nationkey, t.n_name, t.n_regionkey from (select * from cp.`tpch/nation.parquet`) t where t.n_regionkey > 1 order by t.n_name" );

    test("select n.n_regionkey, count(*) as cnt from ( select * from ( select * from cp.`tpch/nation.parquet`) t where t.n_nationkey < 10 ) n where n.n_nationkey >1 group by n.n_regionkey order by n.n_regionkey ; ");

    test("select t.n_regionkey, count(*) as cnt from (select * from cp.`tpch/nation.parquet`) t where t.n_nationkey > 1 group by t.n_regionkey order by t.n_regionkey;" );
  }

  @Test  // Select * in SubQuery : regular columns appear in select clause, where, group by, order by.
  public void testSelStarSubQNoPrefix() throws Exception {
    test("select n_nationkey, n_name, n_regionkey from (select * from cp.`tpch/nation.parquet`)  where n_regionkey > 1 order by n_name" );

    test("select n_regionkey, count(*) as cnt from ( select * from ( select * from cp.`tpch/nation.parquet`)  where n_nationkey < 10 ) where n_nationkey >1 group by n_regionkey order by n_regionkey ; ");

    test("select n_regionkey, count(*) as cnt from (select * from cp.`tpch/nation.parquet`) t where n_nationkey > 1 group by n_regionkey order by n_regionkey;" );
  }

  @Test  // join two SubQuery, each having select * : regular columns appear in the select , where and on clause, group by, order by.
  public void testSelStarSubQJoin() throws Exception {
    // select clause, where.
    test(" select n.n_nationkey, n.n_name, n.n_regionkey, r.r_name \n" +
         " from (select * from cp.`tpch/nation.parquet`) n, \n" +
         "      (select * from cp.`tpch/region.parquet`) r \n" +
         " where n.n_regionkey = r.r_regionkey " );

    // select clause, where, group by, order by
    test(" select n.n_regionkey, count(*) as cnt \n" +
         " from (select * from cp.`tpch/nation.parquet`) n  \n" +
         "    , (select * from cp.`tpch/region.parquet`) r  \n" +
         " where n.n_regionkey = r.r_regionkey and n.n_nationkey > 10 \n" +
         " group by n.n_regionkey \n" +
         " order by n.n_regionkey; " );

    // Outer query use select *. Join condition in where clause.
    test(" select *  \n" +
         " from (select * from cp.`tpch/nation.parquet`) n \n" +
         "    , (select * from cp.`tpch/region.parquet`) r \n" +
         " where n.n_regionkey = r.r_regionkey " );

    // Outer query use select *. Join condition in on clause.
    test(" select *  \n" +
         " from (select * from cp.`tpch/nation.parquet`) n \n" +
         "    join (select * from cp.`tpch/region.parquet`) r \n" +
         " on n.n_regionkey = r.r_regionkey " );
  }

  @Test
  public void testSelectStartSubQueryJoinWithWhereClause() throws Exception {
    // select clause, where, on, group by, order by.
    test(" select n.n_regionkey, count(*) as cnt \n" +
        " from   (select * from cp.`tpch/nation.parquet`) n  \n" +
        "   join (select * from cp.`tpch/region.parquet`) r  \n" +
        " on n.n_regionkey = r.r_regionkey \n" +
        " where n.n_nationkey > 10 \n" +
        " group by n.n_regionkey \n" +
        " order by n.n_regionkey; " );
  }

  @Test // DRILL-595 : Select * in CTE WithClause : regular columns appear in select clause, where, group by, order by.
  public void testDRILL_595WithClause() throws Exception {
    test(" with x as (select * from cp.`region.json`) \n" +
         " select x.region_id, x.sales_city \n" +
         " from x where x.region_id > 10 limit 5;");

    test(" with x as (select * from cp.`region.json`) \n" +
        " select region_id, sales_city \n" +
        " from x where region_id > 10 limit 5;");

    test(" with x as (select * from cp.`tpch/nation.parquet`) \n" +
         " select x.n_regionkey, count(*) as cnt \n" +
         " from x \n" +
         " where x.n_nationkey > 5 \n" +
         " group by x.n_regionkey \n" +
         " order by cnt limit 5; ");

  }

  @Test // DRILL-595 : Join two CTE, each having select * : regular columns appear in the select , where and on clause, group by, order by.
  public void testDRILL_595WithClauseJoin() throws Exception {
    test("with n as (select * from cp.`tpch/nation.parquet`), \n " +
        "     r as (select * from cp.`tpch/region.parquet`) \n" +
        "select n.n_nationkey, n.n_name, n.n_regionkey, r.r_name \n" +
        "from  n, r \n" +
        "where n.n_regionkey = r.r_regionkey ;" );

    test("with n as (select * from cp.`tpch/nation.parquet`), \n " +
        "     r as (select * from cp.`tpch/region.parquet`) \n" +
        "select n.n_regionkey, count(*) as cnt \n" +
        "from  n, r \n" +
        "where n.n_regionkey = r.r_regionkey  and n.n_nationkey > 5 \n" +
        "group by n.n_regionkey \n" +
        "order by cnt;" );
  }

  @Test  // DRILL-1889
  public void testStarWithOtherExpression() throws Exception {
    testBuilder()
        .ordered()
        .sqlQuery("select *  from cp.`tpch/nation.parquet` order by substr(n_name, 2, 5) limit 3")
        .sqlBaselineQuery("select n_comment, n_name, n_nationkey, n_regionkey from cp.`tpch/nation.parquet` order by substr(n_name, 2, 5) limit 3 ")
        .build().run();

    testBuilder()
        .ordered()
        .sqlQuery("select *, n_nationkey + 5 as myexpr from cp.`tpch/nation.parquet` limit 3")
        .sqlBaselineQuery("select n_comment, n_name, n_nationkey, n_regionkey, n_nationkey + 5 as myexpr from cp.`tpch/nation.parquet` order by n_nationkey limit 3")
        .build().run();

    testBuilder()
        .ordered()
        .sqlQuery("select *  from cp.`tpch/nation.parquet` where n_nationkey + 5 > 10 limit 3")
        .sqlBaselineQuery("select n_comment, n_name, n_nationkey, n_regionkey  from cp.`tpch/nation.parquet` where n_nationkey + 5 > 10 order by n_nationkey limit 3")
        .build().run();
  }

  @Test // DRILL-1500
  public void testStarPartitionFilterOrderBy() throws Exception {
    String query = String.format("select * from dfs_test.`%s/multilevel/parquet` where dir0=1994 and dir1='Q1' order by dir0 limit 1", TEST_RES_PATH);
    org.joda.time.DateTime mydate = new org.joda.time.DateTime("1994-01-20T00:00:00.000");

    testBuilder()
    .sqlQuery(query)
    .ordered()
    .baselineColumns("dir0", "dir1", "o_clerk", "o_comment", "o_custkey", "o_orderdate", "o_orderkey",  "o_orderpriority", "o_orderstatus", "o_shippriority",  "o_totalprice")
    .baselineValues("1994", "Q1", "Clerk#000000743", "y pending requests integrate", 1292, mydate, 66, "5-LOW", "F",  0, 104190.66)
    .build().run();
  }

  @Test // DRILL-2069
  public void testStarInSubquery() throws Exception {
    testBuilder()
        .unOrdered()
        .sqlQuery("select * from cp.`tpch/nation.parquet` where n_regionkey in (select r_regionkey from cp.`tpch/region.parquet`)")
        .sqlBaselineQuery("select n_nationkey, n_name, n_regionkey, n_comment from cp.`tpch/nation.parquet` where n_regionkey in (select r_regionkey from cp.`tpch/region.parquet`)")
        .build().run();

    // multiple columns in "IN" subquery predicates.
    testBuilder()
        .unOrdered()
        .sqlQuery("select * from cp.`tpch/nation.parquet` where (n_nationkey, n_name) in ( select n_nationkey, n_name from cp.`tpch/nation.parquet`)")
        .sqlBaselineQuery("select n_nationkey, n_name, n_regionkey, n_comment from cp.`tpch/nation.parquet` where (n_nationkey, n_name) in ( select n_nationkey, n_name from cp.`tpch/nation.parquet`)")
        .build().run();

    // Multiple in subquery predicates.
    testBuilder()
        .unOrdered()
        .sqlQuery(
            "select * from cp.`tpch/nation.parquet` " +
            "where n_regionkey in ( select r_regionkey from cp.`tpch/region.parquet`) and " +
            "      n_name in (select n_name from cp.`tpch/nation.parquet`)")
        .sqlBaselineQuery("select n_nationkey, n_name, n_regionkey, n_comment from cp.`tpch/nation.parquet` " +
            "where n_regionkey in ( select r_regionkey from cp.`tpch/region.parquet`) and " +
            "      n_name in (select n_name from cp.`tpch/nation.parquet`)")
        .build().run();

    // Both the out QB and SUBQ are join.
    testBuilder()
        .unOrdered()
        .sqlQuery(
            "select * from cp.`tpch/nation.parquet` n, cp.`tpch/region.parquet` r " +
            "where n.n_regionkey = r.r_regionkey and " +
            "       (n.n_nationkey, n.n_name) in " +
            "          ( select n2.n_nationkey, n2.n_name " +
            "            from cp.`tpch/nation.parquet` n2, cp.`tpch/region.parquet` r2 " +
            "            where n2.n_regionkey = r2.r_regionkey)")
        .sqlBaselineQuery(
            "select n.n_nationkey, n.n_name, n.n_regionkey, n.n_comment, r.r_regionkey, r.r_name, r.r_comment " +
            "from cp.`tpch/nation.parquet` n, cp.`tpch/region.parquet` r " +
            "where n.n_regionkey = r.r_regionkey and " +
            "       (n.n_nationkey, n.n_name) in " +
            "          ( select n2.n_nationkey, n2.n_name " +
            "            from cp.`tpch/nation.parquet` n2, cp.`tpch/region.parquet` r2 " +
            "            where n2.n_regionkey = r2.r_regionkey)")
        .build().run();
  }
}


text:
package ore.util;

import java.util.Collection;
import java.util.Map;
import java.util.Objects;
import java.util.function.Consumer;
import java.util.function.Predicate;
import java.util.stream.Stream;

/**
 * Utilities that make parameter checks and statements simpler and cleaner.
 *
 * @author NickTheDev
 * @since 1.0.0
 */
public final class Conditions {

    /** Utility class, not to be instantiated. */
    private Conditions() {}

    /**
     * Returns if the specified array is not null, and if all of its contents are not null.
     *
     * @param array Array to be checked for null.
     * @param <T> Type of elements in the array.
     * @return If the array and its contents are not null.
     */
    public static <T> boolean isPresentArray(T[] array) {
        return notNull(array) && Stream.of(array).allMatch(Conditions::notNull);
    }

    /**
     * Returns if the specified collection is not null, and if all of its contents are not null.
     *
     * @param collection Collection to be checked for null.
     * @param <T> Type of elements in the collection.
     * @return If the collection and its contents are not null.
     */
    public static <T> boolean isPresentCollection(Collection<T> collection) {
        return notNull(collection) && isPresentArray(collection.toArray());
    }

    /**
     * Returns if the specified map is not null, and if all of its contents are not null.
     *
     * @param map Map to be checked for null.
     * @param <K> Type of keys in this map.
     * @param <V> Type of mapped values in this map.
     * @return If the map and its contents are not null.
     */
    public static <K, V> boolean isPresentMap(Map<K, V> map) {
        return notNull(map) && isPresentCollection(map.keySet()) && isPresentCollection(map.values());
    }

    /**
     * Checks if the specified value is null, and if so, will return the parameter 'other'. Otherwise, it will return itself.
     *
     * @param value Value checked for null.
     * @param other Value returned if the checked value is null.
     * @param <T> Type of value returned.
     * @return Returns the specified value if not null, otherwise the other value.
     */
    public static <T> T orElse(T value, T other) {
        return notNull(value) ? value : other;
    }

    /**
     * Checks if the specified value returns true when tested by the specified predicate, and if so, returns value. Otherwise, the
     * value other is returned.
     *
     * @param value Value to be tested.
     * @param other Value returned if test returns false.
     * @param predicate Predicate to test value.
     * @param <T> Type of value.
     * @return Value that meets the predicate.
     */
    public static <T> T orElse(T value, T other, Predicate<T> predicate) {
        if(!notNull(value, other, predicate)) {
            return value;
        }

        return predicate.test(value) ? value : other;
    }

    /**
     * Returns whether all specified values are not null.
     *
     * @param values Values checked for null.
     * @param <T> Type of values checked.
     * @return If all values are not null.
     */
    @SafeVarargs
    public static <T> boolean notNull(T... values) {
        return Stream.of(values).allMatch(Objects::nonNull);
    }

    /**
     * Checks if the specified value is not null, and if so, will accept the consumer with specified value.
     *
     * @param value Value checked for null.
     * @param consumer Consumer accepted if the value is not null.
     * @param <T> Type of value accepted.
     */
    public static <T> void ifPresent(T value, Consumer<T> consumer) {
        if(notNull(value, consumer)) {
            consumer.accept(value);
        }

    }

}


text:
<?php

namespace AccountTest\Factory\Action;

use Account\Action\Claim\SetSecurityQuestionsAction;
use Account\Factory\Action\Claim\SetSecurityQuestionsActionFactory;
use Account\Service\ClaimAccountService;
use DvsaCommon\Auth\MotIdentityProviderInterface;
use DvsaCommonTest\TestUtils\XMock;
use DvsaFeature\FeatureToggles;
use Zend\Mvc\Controller\ControllerManager;
use Zend\ServiceManager\ServiceManager;

class SetSecurityQuestionsActionFactoryTest extends \Dvsa\Mot\Frontend\Test\TestCase
{
    public function testFactory()
    {
        $serviceManager = new ServiceManager();

        $mockClaimAccountSrv = XMock::of(ClaimAccountService::class);
        $mockFeatureToggles = XMock::of(FeatureToggles::class);
        $mockIdentityProvider = XMock::of(MotIdentityProviderInterface::class);

        $serviceManager->setService(ClaimAccountService::class, $mockClaimAccountSrv);
        $serviceManager->setService('Feature\FeatureToggles', $mockFeatureToggles);
        $serviceManager->setService('MotIdentityProvider', $mockIdentityProvider);

        $plugins = $this->getMockBuilder(ControllerManager::class)->disableOriginalConstructor()->getMock();

        $plugins->expects($this->at(0))
            ->method('get')
            ->will($this->returnValue($mockClaimAccountSrv));

        $plugins->expects($this->at(1))
            ->method('get')
            ->will($this->returnValue($mockFeatureToggles));

        $plugins->expects($this->at(2))
            ->method('get')
            ->will($this->returnValue($mockIdentityProvider));

        $factory = new SetSecurityQuestionsActionFactory();
        $factoryResult = $factory->createService($plugins);

        $this->assertInstanceOf(SetSecurityQuestionsAction::class, $factoryResult);
    }
}


text:
#include "../../bam_split.c"
#include "../test.h"
#include <stdlib.h>
#include <unistd.h>

void setup_test_1(int* argc, char*** argv)
{
    *argc = 1;
    *argv = (char**)calloc(sizeof(char*), 1);
    (*argv)[0] = strdup("prog_name");
}

bool check_test_1(const parsed_opts_t* opts) {
    if ( opts->merged_input_name != NULL
        || opts->unaccounted_header_name != NULL
        || opts->unaccounted_name != NULL
        || strcmp(opts->output_format_string,"%*_%#.bam")
        || opts->verbose == true )
        return false;
    return true;
}

void setup_test_2(int* argc, char*** argv)
{
    *argc = 2;
    *argv = (char**)calloc(sizeof(char*), 2);
    (*argv)[0] = strdup("prog_name");
    (*argv)[1] = strdup("merged.bam");
}

bool check_test_2(const parsed_opts_t* opts) {
    if ( opts->merged_input_name == NULL
        || strcmp(opts->merged_input_name, "merged.bam")
        || opts->unaccounted_header_name != NULL
        || opts->unaccounted_name != NULL
        || strcmp(opts->output_format_string,"%*_%#.bam")
        || opts->verbose == true )
        return false;
    return true;
}

int main(int argc, char**argv)
{
    // test state
    const int NUM_TESTS = 2;
    int verbose = 0;
    int success = 0;
    int failure = 0;

    int getopt_char;
    while ((getopt_char = getopt(argc, argv, "v")) != -1) {
        switch (getopt_char) {
            case 'v':
                ++verbose;
                break;
            default:
                printf(
                       "usage: test_parse_args [-v]\n\n"
                       " -v verbose output\n"
                       );
                break;
        }
    }

    // Setup stdout and stderr redirect
    size_t len_stdout = 0;
    char* res_stdout = NULL;
    size_t len_stderr = 0;
    char* res_stderr = NULL;
    FILE* orig_stdout = fdopen(dup(STDOUT_FILENO), "a"); // Save stderr
    FILE* orig_stderr = fdopen(dup(STDERR_FILENO), "a"); // Save stderr
    char* tempfname_stdout = (optind < argc)? argv[optind] : "test_parse_args.tmp.o";
    char* tempfname_stderr = (optind < argc)? argv[optind] : "test_parse_args.tmp.e";
    FILE* check_stdout = NULL;
    FILE* check_stderr = NULL;

    // Cleanup getopt
    optind = 1;

    // setup
    if (verbose) fprintf(orig_stdout,"BEGIN test 1\n");  // test eliminating a tag that isn't there
    int argc_1;
    char** argv_1;
    setup_test_1(&argc_1, &argv_1);
    if (verbose > 1) {
        fprintf(orig_stdout, "argc: %d\n", argc_1);
    }
    if (verbose) fprintf(orig_stdout,"RUN test 1\n");

    // test
    xfreopen(tempfname_stdout, "w", stdout); // Redirect stdout to pipe
    xfreopen(tempfname_stderr, "w", stderr); // Redirect stderr to pipe
    parsed_opts_t* result_1 = parse_args(argc_1, argv_1);
    fclose(stdout);
    fclose(stderr);

    if (verbose) fprintf(orig_stdout, "END RUN test 1\n");
    if (verbose > 1) {
        fprintf(orig_stdout, "argc: %d\n", argc_1);
    }

    // check result
    check_stdout = fopen(tempfname_stdout, "r");
    check_stderr = fopen(tempfname_stderr, "r");
    if ( !result_1
        && (getline(&res_stdout, &len_stdout, check_stdout) != -1)
        && !feof(check_stdout)
        && (res_stdout && strcmp("",res_stdout))
        && (getline(&res_stderr, &len_stderr, check_stderr) == -1)
        && (feof(check_stderr) || (res_stderr && !strcmp("",res_stderr)))) {
        ++success;
    } else {
        ++failure;
        if (verbose) fprintf(orig_stdout, "FAIL test 1\n");
    }
    fclose(check_stderr);
    fclose(check_stdout);

    // teardown
    cleanup_opts(result_1);
    int i = 0;
    for (i = 0; i < argc_1; ++i) {
        free(argv_1[i]);
    }
    free(argv_1);
    if (verbose) fprintf(orig_stdout, "END test 1\n");

    // Cleanup getopt
    optind = 1;

    if (verbose) fprintf(orig_stdout, "BEGIN test 2\n");  // test eliminating a tag that is there
    int argc_2;
    char** argv_2;
    setup_test_2(&argc_2, &argv_2);
    if (verbose > 1) {
        fprintf(orig_stdout, "argc: %d\n", argc_2);
    }
    if (verbose) fprintf(orig_stdout, "RUN test 2\n");

    // test
    xfreopen(tempfname_stdout, "w", stdout); // Redirect stdout to pipe
    xfreopen(tempfname_stderr, "w", stderr); // Redirect stderr to pipe
    parsed_opts_t* result_2 = parse_args(argc_2, argv_2);
    fclose(stdout);
    fclose(stderr);

    if (verbose) fprintf(orig_stdout, "END RUN test 2\n");
    if (verbose > 1) {
        fprintf(orig_stdout, "argc: %d\n", argc_2);
    }

    // check result
    check_stdout = fopen(tempfname_stdout, "r");
    check_stderr = fopen(tempfname_stderr, "r");
    if ( result_2
        && check_test_2(result_2)
        && (getline(&res_stdout, &len_stdout, check_stdout) == -1)
        && (feof(check_stdout) || (res_stdout && !strcmp("",res_stdout)))
        && (getline(&res_stderr, &len_stderr, check_stderr) == -1)
        && (feof(check_stderr) || (res_stderr && !strcmp("",res_stderr)))) {
        ++success;
    } else {
        ++failure;
        if (verbose) fprintf(orig_stdout, "FAIL test 2\n");
    }
    fclose(check_stdout);
    fclose(check_stderr);

    // teardown
    cleanup_opts(result_2);
    int j = 0;
    for (j = 0; j < argc_2; ++j) {
        free(argv_2[j]);
    }
    free(argv_2);

    if (verbose) fprintf(orig_stdout, "END test 2\n");

    // Cleanup
    free(res_stdout);
    free(res_stderr);
    remove(tempfname_stdout);
    remove(tempfname_stderr);
    fclose(orig_stdout);
    if (failure > 0)
        fprintf(orig_stderr, "%d failures %d successes\n", failure, success);
    fclose(orig_stderr);

    return (success == NUM_TESTS)? EXIT_SUCCESS : EXIT_FAILURE;
}