text:
Ember.js is a framework for building ambitious client-side applications on the
web. Now you can use the same Ember tools in node code and in node-based asset
pipelines like [Convoy](http://github.com/charlesjolley/convoy).

# Using This Package

Just add ember as a requirement to your package.json:

```javascript
"dependencies": {
  ...
  "ember": "~0.9"
}
```

In your code, you can load the entire Ember stack by just requiring the package.
This will add Ember to the global namespace in your application.

```javascript
require('ember');

MyApp = Ember.Application.create({
  hi: function() { console.log('Hi! I'm an app!'); }
});
```

If you don't want to use the entire Ember stack, you can just require the
specific module that you want. For example, a lot of server side code just
needs States for statecharting:

```javascript
require('ember/states');

MyState = Ember.State.create({

});
```

# Using Ember with Convoy

Building an Ember application in the browser is very easy when using Convoy.
Just require ember in your main application file.

```javascript
// In some JS module included by convoy:
require('ember'); // <- convoy will automatically pull in all of Ember.

UserView = Ember.View.extend({
  template: Ember.Handlebars.compile('{{firstName}} {{lastName}}')
});
```

If you want to store your Handlebars templates in a separate file, Ember for
Node has a HandlebarsCompiler that will precompile the templates for you.
Here is an example Convoy pipeline configuration:

```javascript
pipeline = convoy({
  'app.js': {
    packager: 'javascript',
    compilers: {
      '.hbr': require('ember/packager').HandlebarsCompiler
    }
  }
});

app = express.createServer();
app.use(pipeline.middleware());
```

This will now make `.hbr` files available as modules. In your app code, you
can load the template via a normal require:

```javascript
// user_view.js

require('ember/views');

UserView = Ember.View.extend({
  template: require('./user_template') // template in user_template.hbr
});
```

For a fully functioning example of an application, check out the
[examples](https://github.com/charlesjolley/node-ember/tree/master/examples)
folder.

# Building From Source

This project checks out the ember source and builds compiled copies for use in the released version. If you want to rebuild this from source, here is what you need to do:

1.  Make sure you have [node.js](http://nodejs.org) and Jake installed globally. Once
    you have node.js installed you can install jake with the command
    `[sudo] npm install -g jake`
2.  Also make sure you have Ruby 1.9.3 or later installed as well as bundler. Once
    you have ruby installed you can install bundler with `[sudo] gem install bundler`
3.  Clone [the node-ember repo](http://github.com/charlesjolley/node-ember)
4.  From the repo directory run `jake vendor:setup`. This should checkout the correct
    versions of ember and ember-data and set them up to build
5.  Run `jake diet` to actually build the assets.

Note that you only need to run `vendor:setup` once the first time you install the report or anytime the version of ember or ember-data changes. Afterwards, you should be able to run `dist` just to rebuild.

ember and ember-data are linked into this project as git submodules. To update to a newer (or older) version of ember or ember-data, cd into the vendor directory and checkout the version you want. Then cd back to the top level of the repo and commit the updates into git. Once completed, run `jake vendor:setup` again to update the contents.

**IMPORTANT:** The dist command will checkout whichever version of ember or ember-data are set in the submodule, so you must commit to git before rebuilding.


text:
package noderesources

import (
	"context"
	"reflect"
	"testing"

	"github.com/google/go-cmp/cmp"
	"github.com/google/go-cmp/cmp/cmpopts"
	v1 "k8s.io/api/core/v1"
	"k8s.io/apimachinery/pkg/api/resource"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/apimachinery/pkg/util/validation/field"
	"k8s.io/kubernetes/pkg/scheduler/apis/config"
	"k8s.io/kubernetes/pkg/scheduler/framework"
	"k8s.io/kubernetes/pkg/scheduler/framework/runtime"
	"k8s.io/kubernetes/pkg/scheduler/internal/cache"
)

func TestNodeResourcesLeastAllocated(t *testing.T) {
	labels1 := map[string]string{
		"foo": "bar",
		"baz": "blah",
	}
	labels2 := map[string]string{
		"bar": "foo",
		"baz": "blah",
	}
	machine1Spec := v1.PodSpec{
		NodeName: "machine1",
	}
	machine2Spec := v1.PodSpec{
		NodeName: "machine2",
	}
	noResources := v1.PodSpec{
		Containers: []v1.Container{},
	}
	cpuOnly := v1.PodSpec{
		NodeName: "machine1",
		Containers: []v1.Container{
			{
				Resources: v1.ResourceRequirements{
					Requests: v1.ResourceList{
						v1.ResourceCPU:    resource.MustParse("1000m"),
						v1.ResourceMemory: resource.MustParse("0"),
					},
				},
			},
			{
				Resources: v1.ResourceRequirements{
					Requests: v1.ResourceList{
						v1.ResourceCPU:    resource.MustParse("2000m"),
						v1.ResourceMemory: resource.MustParse("0"),
					},
				},
			},
		},
	}
	cpuOnly2 := cpuOnly
	cpuOnly2.NodeName = "machine2"
	cpuAndMemory := v1.PodSpec{
		NodeName: "machine2",
		Containers: []v1.Container{
			{
				Resources: v1.ResourceRequirements{
					Requests: v1.ResourceList{
						v1.ResourceCPU:    resource.MustParse("1000m"),
						v1.ResourceMemory: resource.MustParse("2000"),
					},
				},
			},
			{
				Resources: v1.ResourceRequirements{
					Requests: v1.ResourceList{
						v1.ResourceCPU:    resource.MustParse("2000m"),
						v1.ResourceMemory: resource.MustParse("3000"),
					},
				},
			},
		},
	}
	defaultResourceLeastAllocatedSet := []config.ResourceSpec{
		{Name: string(v1.ResourceCPU), Weight: 1},
		{Name: string(v1.ResourceMemory), Weight: 1},
	}
	tests := []struct {
		pod          *v1.Pod
		pods         []*v1.Pod
		nodes        []*v1.Node
		args         config.NodeResourcesLeastAllocatedArgs
		wantErr      error
		expectedList framework.NodeScoreList
		name         string
	}{
		{
			// Node1 scores (remaining resources) on 0-MaxNodeScore scale
			// CPU Score: ((4000 - 0) * MaxNodeScore) / 4000 = MaxNodeScore
			// Memory Score: ((10000 - 0) * MaxNodeScore) / 10000 = MaxNodeScore
			// Node1 Score: (100 + 100) / 2 = 100
			// Node2 scores (remaining resources) on 0-MaxNodeScore scale
			// CPU Score: ((4000 - 0) * MaxNodeScore) / 4000 = MaxNodeScore
			// Memory Score: ((10000 - 0) * MaxNodeScore) / 10000 = MaxNodeScore
			// Node2 Score: (MaxNodeScore + MaxNodeScore) / 2 = MaxNodeScore
			pod:          &v1.Pod{Spec: noResources},
			nodes:        []*v1.Node{makeNode("machine1", 4000, 10000), makeNode("machine2", 4000, 10000)},
			args:         config.NodeResourcesLeastAllocatedArgs{Resources: defaultResourceLeastAllocatedSet},
			expectedList: []framework.NodeScore{{Name: "machine1", Score: framework.MaxNodeScore}, {Name: "machine2", Score: framework.MaxNodeScore}},
			name:         "nothing scheduled, nothing requested",
		},
		{
			// Node1 scores on 0-MaxNodeScore scale
			// CPU Score: ((4000 - 3000) * MaxNodeScore) / 4000 = 25
			// Memory Score: ((10000 - 5000) * MaxNodeScore) / 10000 = 50
			// Node1 Score: (25 + 50) / 2 = 37
			// Node2 scores on 0-MaxNodeScore scale
			// CPU Score: ((6000 - 3000) * MaxNodeScore) / 6000 = 50
			// Memory Score: ((10000 - 5000) * MaxNodeScore) / 10000 = 50
			// Node2 Score: (50 + 50) / 2 = 50
			pod:          &v1.Pod{Spec: cpuAndMemory},
			nodes:        []*v1.Node{makeNode("machine1", 4000, 10000), makeNode("machine2", 6000, 10000)},
			args:         config.NodeResourcesLeastAllocatedArgs{Resources: defaultResourceLeastAllocatedSet},
			expectedList: []framework.NodeScore{{Name: "machine1", Score: 37}, {Name: "machine2", Score: 50}},
			name:         "nothing scheduled, resources requested, differently sized machines",
		},
		{
			// Node1 scores on 0-MaxNodeScore scale
			// CPU Score: ((4000 - 0) * MaxNodeScore) / 4000 = MaxNodeScore
			// Memory Score: ((10000 - 0) * MaxNodeScore) / 10000 = MaxNodeScore
			// Node1 Score: (MaxNodeScore + MaxNodeScore) / 2 = MaxNodeScore
			// Node2 scores on 0-MaxNodeScore scale
			// CPU Score: ((4000 - 0) * MaxNodeScore) / 4000 = MaxNodeScore
			// Memory Score: ((10000 - 0) * MaxNodeScore) / 10000 = MaxNodeScore
			// Node2 Score: (MaxNodeScore + MaxNodeScore) / 2 = MaxNodeScore
			pod:          &v1.Pod{Spec: noResources},
			nodes:        []*v1.Node{makeNode("machine1", 4000, 10000), makeNode("machine2", 4000, 10000)},
			args:         config.NodeResourcesLeastAllocatedArgs{Resources: defaultResourceLeastAllocatedSet},
			expectedList: []framework.NodeScore{{Name: "machine1", Score: framework.MaxNodeScore}, {Name: "machine2", Score: framework.MaxNodeScore}},
			name:         "no resources requested, pods scheduled",
			pods: []*v1.Pod{
				{Spec: machine1Spec, ObjectMeta: metav1.ObjectMeta{Labels: labels2}},
				{Spec: machine1Spec, ObjectMeta: metav1.ObjectMeta{Labels: labels1}},
				{Spec: machine2Spec, ObjectMeta: metav1.ObjectMeta{Labels: labels1}},
				{Spec: machine2Spec, ObjectMeta: metav1.ObjectMeta{Labels: labels1}},
			},
		},
		{
			// Node1 scores on 0-MaxNodeScore scale
			// CPU Score: ((10000 - 6000) * MaxNodeScore) / 10000 = 40
			// Memory Score: ((20000 - 0) * MaxNodeScore) / 20000 = MaxNodeScore
			// Node1 Score: (40 + 100) / 2 = 70
			// Node2 scores on 0-MaxNodeScore scale
			// CPU Score: ((10000 - 6000) * MaxNodeScore) / 10000 = 40
			// Memory Score: ((20000 - 5000) * MaxNodeScore) / 20000 = 75
			// Node2 Score: (40 + 75) / 2 = 57
			pod:          &v1.Pod{Spec: noResources},
			nodes:        []*v1.Node{makeNode("machine1", 10000, 20000), makeNode("machine2", 10000, 20000)},
			args:         config.NodeResourcesLeastAllocatedArgs{Resources: defaultResourceLeastAllocatedSet},
			expectedList: []framework.NodeScore{{Name: "machine1", Score: 70}, {Name: "machine2", Score: 57}},
			name:         "no resources requested, pods scheduled with resources",
			pods: []*v1.Pod{
				{Spec: cpuOnly, ObjectMeta: metav1.ObjectMeta{Labels: labels2}},
				{Spec: cpuOnly, ObjectMeta: metav1.ObjectMeta{Labels: labels1}},
				{Spec: cpuOnly2, ObjectMeta: metav1.ObjectMeta{Labels: labels1}},
				{Spec: cpuAndMemory, ObjectMeta: metav1.ObjectMeta{Labels: labels1}},
			},
		},
		{
			// Node1 scores on 0-MaxNodeScore scale
			// CPU Score: ((10000 - 6000) * MaxNodeScore) / 10000 = 40
			// Memory Score: ((20000 - 5000) * MaxNodeScore) / 20000 = 75
			// Node1 Score: (40 + 75) / 2 = 57
			// Node2 scores on 0-MaxNodeScore scale
			// CPU Score: ((10000 - 6000) * MaxNodeScore) / 10000 = 40
			// Memory Score: ((20000 - 10000) * MaxNodeScore) / 20000 = 50
			// Node2 Score: (40 + 50) / 2 = 45
			pod:          &v1.Pod{Spec: cpuAndMemory},
			nodes:        []*v1.Node{makeNode("machine1", 10000, 20000), makeNode("machine2", 10000, 20000)},
			args:         config.NodeResourcesLeastAllocatedArgs{Resources: defaultResourceLeastAllocatedSet},
			expectedList: []framework.NodeScore{{Name: "machine1", Score: 57}, {Name: "machine2", Score: 45}},
			name:         "resources requested, pods scheduled with resources",
			pods: []*v1.Pod{
				{Spec: cpuOnly},
				{Spec: cpuAndMemory},
			},
		},
		{
			// Node1 scores on 0-MaxNodeScore scale
			// CPU Score: ((10000 - 6000) * MaxNodeScore) / 10000 = 40
			// Memory Score: ((20000 - 5000) * MaxNodeScore) / 20000 = 75
			// Node1 Score: (40 + 75) / 2 = 57
			// Node2 scores on 0-MaxNodeScore scale
			// CPU Score: ((10000 - 6000) * MaxNodeScore) / 10000 = 40
			// Memory Score: ((50000 - 10000) * MaxNodeScore) / 50000 = 80
			// Node2 Score: (40 + 80) / 2 = 60
			pod:          &v1.Pod{Spec: cpuAndMemory},
			nodes:        []*v1.Node{makeNode("machine1", 10000, 20000), makeNode("machine2", 10000, 50000)},
			args:         config.NodeResourcesLeastAllocatedArgs{Resources: defaultResourceLeastAllocatedSet},
			expectedList: []framework.NodeScore{{Name: "machine1", Score: 57}, {Name: "machine2", Score: 60}},
			name:         "resources requested, pods scheduled with resources, differently sized machines",
			pods: []*v1.Pod{
				{Spec: cpuOnly},
				{Spec: cpuAndMemory},
			},
		},
		{
			// Node1 scores on 0-MaxNodeScore scale
			// CPU Score: ((4000 - 6000) * MaxNodeScore) / 4000 = 0
			// Memory Score: ((10000 - 0) * MaxNodeScore) / 10000 = MaxNodeScore
			// Node1 Score: (0 + MaxNodeScore) / 2 = 50
			// Node2 scores on 0-MaxNodeScore scale
			// CPU Score: ((4000 - 6000) * MaxNodeScore) / 4000 = 0
			// Memory Score: ((10000 - 5000) * MaxNodeScore) / 10000 = 50
			// Node2 Score: (0 + 50) / 2 = 25
			pod:          &v1.Pod{Spec: cpuOnly},
			nodes:        []*v1.Node{makeNode("machine1", 4000, 10000), makeNode("machine2", 4000, 10000)},
			args:         config.NodeResourcesLeastAllocatedArgs{Resources: defaultResourceLeastAllocatedSet},
			expectedList: []framework.NodeScore{{Name: "machine1", Score: 50}, {Name: "machine2", Score: 25}},
			name:         "requested resources exceed node capacity",
			pods: []*v1.Pod{
				{Spec: cpuOnly},
				{Spec: cpuAndMemory},
			},
		},
		{
			pod:          &v1.Pod{Spec: noResources},
			nodes:        []*v1.Node{makeNode("machine1", 0, 0), makeNode("machine2", 0, 0)},
			args:         config.NodeResourcesLeastAllocatedArgs{Resources: defaultResourceLeastAllocatedSet},
			expectedList: []framework.NodeScore{{Name: "machine1", Score: 0}, {Name: "machine2", Score: 0}},
			name:         "zero node resources, pods scheduled with resources",
			pods: []*v1.Pod{
				{Spec: cpuOnly},
				{Spec: cpuAndMemory},
			},
		},
		{
			// CPU Score: ((4000 - 3000) *100) / 4000 = 25
			// Memory Score: ((10000 - 5000) *100) / 10000 = 50
			// Node1 Score: (25 * 1 + 50 * 2) / (1 + 2) = 41
			// CPU Score: ((6000 - 3000) *100) / 6000 = 50
			// Memory Score: ((10000 - 5000) *100) / 10000 = 50
			// Node2 Score: (50 * 1 + 50 * 2) / (1 + 2) = 50
			pod:          &v1.Pod{Spec: cpuAndMemory},
			nodes:        []*v1.Node{makeNode("machine1", 4000, 10000), makeNode("machine2", 6000, 10000)},
			args:         config.NodeResourcesLeastAllocatedArgs{Resources: []config.ResourceSpec{{Name: "memory", Weight: 2}, {Name: "cpu", Weight: 1}}},
			expectedList: []framework.NodeScore{{Name: "machine1", Score: 41}, {Name: "machine2", Score: 50}},
			name:         "nothing scheduled, resources requested with different weight on CPU and memory, differently sized machines",
		},
		{
			// resource with negtive weight is not allowed
			pod:   &v1.Pod{Spec: cpuAndMemory},
			nodes: []*v1.Node{makeNode("machine", 4000, 10000)},
			args:  config.NodeResourcesLeastAllocatedArgs{Resources: []config.ResourceSpec{{Name: "memory", Weight: -1}, {Name: "cpu", Weight: 1}}},
			wantErr: field.ErrorList{
				&field.Error{
					Type:  field.ErrorTypeInvalid,
					Field: "resources[0].weight",
				},
			}.ToAggregate(),
			name: "resource with negtive weight",
		},
		{
			// resource with zero weight is not allowed
			pod:   &v1.Pod{Spec: cpuAndMemory},
			nodes: []*v1.Node{makeNode("machine", 4000, 10000)},
			args:  config.NodeResourcesLeastAllocatedArgs{Resources: []config.ResourceSpec{{Name: "memory", Weight: 1}, {Name: "cpu", Weight: 0}}},
			wantErr: field.ErrorList{
				&field.Error{
					Type:  field.ErrorTypeInvalid,
					Field: "resources[1].weight",
				},
			}.ToAggregate(),
			name: "resource with zero weight",
		},
		{
			// resource weight should be less than MaxNodeScore
			pod:   &v1.Pod{Spec: cpuAndMemory},
			nodes: []*v1.Node{makeNode("machine", 4000, 10000)},
			args:  config.NodeResourcesLeastAllocatedArgs{Resources: []config.ResourceSpec{{Name: "memory", Weight: 120}}},
			wantErr: field.ErrorList{
				&field.Error{
					Type:  field.ErrorTypeInvalid,
					Field: "resources[0].weight",
				},
			}.ToAggregate(),
			name: "resource weight larger than MaxNodeScore",
		},
	}

	for _, test := range tests {
		t.Run(test.name, func(t *testing.T) {
			snapshot := cache.NewSnapshot(test.pods, test.nodes)
			fh, _ := runtime.NewFramework(nil, nil, nil, runtime.WithSnapshotSharedLister(snapshot))
			p, err := NewLeastAllocated(&test.args, fh)

			if test.wantErr != nil {
				if err != nil {
					diff := cmp.Diff(test.wantErr, err, cmpopts.IgnoreFields(field.Error{}, "BadValue", "Detail"))
					if diff != "" {
						t.Fatalf("got err (-want,+got):\n%s", diff)
					}
				} else {
					t.Fatalf("no error produced, wanted %v", test.wantErr)
				}
				return
			}

			if err != nil && test.wantErr == nil {
				t.Fatalf("failed to initialize plugin NodeResourcesLeastAllocated, got error: %v", err)
			}

			for i := range test.nodes {
				hostResult, err := p.(framework.ScorePlugin).Score(context.Background(), nil, test.pod, test.nodes[i].Name)
				if err != nil {
					t.Errorf("unexpected error: %v", err)
				}
				if !reflect.DeepEqual(test.expectedList[i].Score, hostResult) {
					t.Errorf("expected %#v, got %#v", test.expectedList[i].Score, hostResult)
				}
			}
		})
	}
}

redpajama_set_name: RedPajamaGithub


text:
\hypertarget{classtesting_1_1internal_1_1_pair_match_base}{}\section{testing\+:\+:internal\+:\+:Pair\+Match\+Base$<$ D, Op $>$ Class Template Reference}
\label{classtesting_1_1internal_1_1_pair_match_base}\index{testing\+::internal\+::\+Pair\+Match\+Base$<$ D, Op $>$@{testing\+::internal\+::\+Pair\+Match\+Base$<$ D, Op $>$}}

{\ttfamily \#include $<$gmock-\/matchers.\+h$>$}

\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item
{\footnotesize template$<$typename T1 , typename T2 $>$ }\\\hyperlink{classtesting_1_1internal_1_1_pair_match_base_a8f927cfe9008f7c35dcb03275bc69762}{operator Matcher$<$ \+::testing\+::tuple$<$ T1, T2 $>$ $>$} () const
\item
{\footnotesize template$<$typename T1 , typename T2 $>$ }\\\hyperlink{classtesting_1_1internal_1_1_pair_match_base_a51667d1fc49779ceff1bbf334bfe0470}{operator Matcher$<$ const \+::testing\+::tuple$<$ T1, T2 $>$ \& $>$} () const
\end{DoxyCompactItemize}

\subsection{Detailed Description}
\subsubsection*{template$<$typename D, typename Op$>$\\*
class testing\+::internal\+::\+Pair\+Match\+Base$<$ D, Op $>$}

Definition at line 1381 of file gmock-\/matchers.\+h.

\subsection{Member Function Documentation}
\index{testing\+::internal\+::\+Pair\+Match\+Base@{testing\+::internal\+::\+Pair\+Match\+Base}!operator Matcher$<$ \+::testing\+::tuple$<$ T1, T2 $>$ $>$@{operator Matcher$<$ \+::testing\+::tuple$<$ T1, T2 $>$ $>$}}
\index{operator Matcher$<$ \+::testing\+::tuple$<$ T1, T2 $>$ $>$@{operator Matcher$<$ \+::testing\+::tuple$<$ T1, T2 $>$ $>$}!testing\+::internal\+::\+Pair\+Match\+Base@{testing\+::internal\+::\+Pair\+Match\+Base}}
\subsubsection[{\texorpdfstring{operator Matcher$<$ \+::testing\+::tuple$<$ T1, T2 $>$ $>$() const }{operator Matcher< ::testing::tuple< T1, T2 > >() const }}]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename D, typename Op$>$ template$<$typename T1 , typename T2 $>$ {\bf testing\+::internal\+::\+Pair\+Match\+Base}$<$ D, Op $>$\+::operator {\bf Matcher}$<$ \+::testing\+::tuple$<$ T1, T2 $>$ $>$ (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily [inline]}}\hypertarget{classtesting_1_1internal_1_1_pair_match_base_a8f927cfe9008f7c35dcb03275bc69762}{}\label{classtesting_1_1internal_1_1_pair_match_base_a8f927cfe9008f7c35dcb03275bc69762}

Definition at line 1384 of file gmock-\/matchers.\+h.

\index{testing\+::internal\+::\+Pair\+Match\+Base@{testing\+::internal\+::\+Pair\+Match\+Base}!operator Matcher$<$ const \+::testing\+::tuple$<$ T1, T2 $>$ \& $>$@{operator Matcher$<$ const \+::testing\+::tuple$<$ T1, T2 $>$ \& $>$}}
\index{operator Matcher$<$ const \+::testing\+::tuple$<$ T1, T2 $>$ \& $>$@{operator Matcher$<$ const \+::testing\+::tuple$<$ T1, T2 $>$ \& $>$}!testing\+::internal\+::\+Pair\+Match\+Base@{testing\+::internal\+::\+Pair\+Match\+Base}}
\subsubsection[{\texorpdfstring{operator Matcher$<$ const \+::testing\+::tuple$<$ T1, T2 $>$ \& $>$() const }{operator Matcher< const ::testing::tuple< T1, T2 > & >() const }}]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename D, typename Op$>$ template$<$typename T1 , typename T2 $>$ {\bf testing\+::internal\+::\+Pair\+Match\+Base}$<$ D, Op $>$\+::operator {\bf Matcher}$<$ const \+::testing\+::tuple$<$ T1, T2 $>$ \& $>$ (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily [inline]}}\hypertarget{classtesting_1_1internal_1_1_pair_match_base_a51667d1fc49779ceff1bbf334bfe0470}{}\label{classtesting_1_1internal_1_1_pair_match_base_a51667d1fc49779ceff1bbf334bfe0470}

Definition at line 1388 of file gmock-\/matchers.\+h.

The documentation for this class was generated from the following file\+:\begin{DoxyCompactItemize}
\item
/home/bhargavi/\+Documents/\+S\+D\+R/\+Copy\+\_\+\+Exam\+\_\+808\+X/vendor/googletest/googlemock/include/gmock/\hyperlink{gmock-matchers_8h}{gmock-\/matchers.\+h}\end{DoxyCompactItemize}


text:
function ShowPanelInfo(Panel) {
   alert(Panel.Name + '\n' + Panel.GSize.x + ' x ' + Panel.GSize.y);
}


text:
package org.apache.hadoop.hbase.ipc;

import org.apache.hadoop.hbase.classification.InterfaceAudience;

@InterfaceAudience.Public
public class UnsupportedCompressionCodecException extends FatalConnectionException {
  public UnsupportedCompressionCodecException() {
    super();
  }

  public UnsupportedCompressionCodecException(String msg) {
    super(msg);
  }

  public UnsupportedCompressionCodecException(String msg, Throwable t) {
    super(msg, t);
  }
}


text:
from agents.flatBot.flatBot import FlatBot
from integration_test.history import HistoryIO

'''
An integration test bot which writes the packets it gets to disk.
'''

class FrameworkTestAgent(FlatBot):
    last_time = None

    def __init__(self, *args, **kwargs):
        self.historyIO = HistoryIO()
        self.historyIO.clear()
        self.game_tick_flat_binary = None
        super().__init__(*args, **kwargs)

    def set_flatbuffer_binary(self, game_tick_flat_binary):
        self.game_tick_flat_binary = game_tick_flat_binary

    def get_output_flatbuffer(self, game_tick_flatbuffer):
        builder = super().get_output_flatbuffer(game_tick_flatbuffer)
        self.historyIO.append(self.game_tick_flat_binary, builder.Output())
        return builder


text:
 //https://bl.ocks.org/emeeks/03396c05b39b8198685f3e46942c87e3
 const dividedLine = (parameters, points, searchIterations) => {
   let currentParameters = parameters(points[0], 0)
   let currentPointsArray = []
   let dividedLinesData = [ { key: currentParameters, points: currentPointsArray } ]
   points.forEach((point, pointI) => {

     const newParameters = parameters(point, pointI)
     let matchingParams = newParameters === currentParameters;

     if (typeof currentParameters === "object") {
       matchingParams = JSON.stringify(newParameters) === JSON.stringify(currentParameters)
     }

     if (matchingParams) {
       currentPointsArray.push(point)
     } else {
       const lastPoint = currentPointsArray[currentPointsArray.length - 1];
       let pointA = lastPoint;
       let pointB = point;

       for (let x = 0; x < searchIterations; x++) {
         const keys = Object.keys(pointA)
         const findPoints = simpleSearchFunction(pointA, pointB, currentParameters, parameters, keys)
         pointA = findPoints[0]
         pointB = findPoints[1]
       }
       currentPointsArray.push(pointB)
       currentPointsArray = [ pointB, point ]
       dividedLinesData.push({ key: newParameters, points: currentPointsArray })
       currentParameters = newParameters
     }
   })
   return dividedLinesData
 }

 function simpleSearchFunction(pointA, pointB, current, parameters, keys) {
   const betweenPoint = { };
   keys.forEach(key => {
     betweenPoint[key] = typeof pointA[key] === "number" ? (pointA[key] + pointB[key]) / 2 : pointB[key]
   })

   if (JSON.stringify(parameters(betweenPoint)) === JSON.stringify(current)) {
     return [ betweenPoint, pointB ]
   }
   return [ pointA, betweenPoint ]
 }

 function parameters(point) {
   const steve = new Date("7/9/1997")
   if (new Date(point.Date) < steve) {
     return "AAPL Before Steve Jobs Returns"
   }
   if (point.Close > 100) {
     return "AAPL Above $100"
   }
   return "AAPL"
 }

 //----Finish divided line----


text:
package org.apache.beam.examples.complete;

import java.util.Date;
import org.apache.beam.sdk.io.FileSystems;
import org.apache.beam.sdk.io.fs.ResolveOptions.StandardResolveOptions;
import org.apache.beam.sdk.options.PipelineOptionsFactory;
import org.apache.beam.sdk.testing.FileChecksumMatcher;
import org.apache.beam.sdk.testing.TestPipeline;
import org.apache.beam.sdk.testing.TestPipelineOptions;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

/** End-to-end tests of TopWikipediaSessions. */
@RunWith(JUnit4.class)
public class TopWikipediaSessionsIT {

  private static final String DEFAULT_INPUT_10_FILES =
      "gs://apache-beam-samples/wikipedia_edits/wiki_data-000000000000.json";
  private static final String DEFAULT_OUTPUT_CHECKSUM = "13347784d49129bade295c371e30f9eb5325318a";

  /** PipelineOptions for the TopWikipediaSessions integration test. */
  public interface TopWikipediaSessionsITOptions
      extends TestPipelineOptions, TopWikipediaSessions.Options {}

  @BeforeClass
  public static void setUp() {
    PipelineOptionsFactory.register(TestPipelineOptions.class);
  }

  @Test
  public void testE2ETopWikiPages() throws Exception {
    TopWikipediaSessionsITOptions options =
        TestPipeline.testingPipelineOptions().as(TopWikipediaSessionsITOptions.class);

    options.setWikiInput(DEFAULT_INPUT_10_FILES);
    options.setOutput(
        FileSystems.matchNewResource(options.getTempRoot(), true)
            .resolve(
                String.format("topwikisessions-it-%tF-%<tH-%<tM-%<tS-%<tL", new Date()),
                StandardResolveOptions.RESOLVE_DIRECTORY)
            .resolve("output", StandardResolveOptions.RESOLVE_DIRECTORY)
            .resolve("results", StandardResolveOptions.RESOLVE_FILE)
            .toString());
    options.setOnSuccessMatcher(
        new FileChecksumMatcher(DEFAULT_OUTPUT_CHECKSUM, options.getOutput() + "*-of-*"));

    TopWikipediaSessions.run(options);
  }
}


text:
namespace SphereStudio.Plugins.Components
{
    partial class BaseEditor
    {
        /// <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 Component 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.FrameImage = new SphereStudio.UI.SnapPanel();
            this.BaseStatusStrip = new System.Windows.Forms.StatusStrip();
            this.XYLabel = new System.Windows.Forms.ToolStripStatusLabel();
            this.WHLabel = new System.Windows.Forms.ToolStripStatusLabel();
            this.DirectionLabel = new SphereStudio.UI.DialogHeader();
            this.BasePanel = new System.Windows.Forms.Panel();
            this.BaseStatusStrip.SuspendLayout();
            this.BasePanel.SuspendLayout();
            this.SuspendLayout();
            //
            // FrameImage
            //
            this.FrameImage.BackgroundImage = global::SphereStudio.Plugins.Properties.Resources.EditAreaBG2;
            this.FrameImage.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.FrameImage.Location = new System.Drawing.Point(64, 30);
            this.FrameImage.Name = "FrameImage";
            this.FrameImage.Size = new System.Drawing.Size(96, 96);
            this.FrameImage.TabIndex = 0;
            this.FrameImage.XSnap = 0;
            this.FrameImage.YSnap = 0;
            this.FrameImage.Paint += new System.Windows.Forms.PaintEventHandler(this.FrameImage_Paint);
            this.FrameImage.MouseDown += new System.Windows.Forms.MouseEventHandler(this.FrameImage_MouseDown);
            this.FrameImage.MouseMove += new System.Windows.Forms.MouseEventHandler(this.FrameImage_MouseMove);
            this.FrameImage.MouseUp += new System.Windows.Forms.MouseEventHandler(this.FrameImage_MouseUp);
            //
            // BaseStatusStrip
            //
            this.BaseStatusStrip.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(192)))), ((int)(((byte)(255)))));
            this.BaseStatusStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.XYLabel,
            this.WHLabel});
            this.BaseStatusStrip.Location = new System.Drawing.Point(0, 179);
            this.BaseStatusStrip.Name = "BaseStatusStrip";
            this.BaseStatusStrip.Size = new System.Drawing.Size(224, 24);
            this.BaseStatusStrip.SizingGrip = false;
            this.BaseStatusStrip.TabIndex = 2;
            this.BaseStatusStrip.Text = "Base Status";
            //
            // XYLabel
            //
            this.XYLabel.BackColor = System.Drawing.Color.Transparent;
            this.XYLabel.BorderSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.Right;
            this.XYLabel.Name = "XYLabel";
            this.XYLabel.Size = new System.Drawing.Size(71, 19);
            this.XYLabel.Text = "X, Y = (0, 0)";
            //
            // WHLabel
            //
            this.WHLabel.BackColor = System.Drawing.Color.Transparent;
            this.WHLabel.BorderSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.Left;
            this.WHLabel.Name = "WHLabel";
            this.WHLabel.Size = new System.Drawing.Size(77, 19);
            this.WHLabel.Text = "W, H = (0, 0)";
            //
            // DirectionLabel
            //
            this.DirectionLabel.Dock = System.Windows.Forms.DockStyle.Top;
            this.DirectionLabel.Font = new System.Drawing.Font("Verdana", 10.5F);
            this.DirectionLabel.ForeColor = System.Drawing.Color.MidnightBlue;
            this.DirectionLabel.Location = new System.Drawing.Point(0, 0);
            this.DirectionLabel.Name = "DirectionLabel";
            this.DirectionLabel.Size = new System.Drawing.Size(224, 23);
            this.DirectionLabel.TabIndex = 3;
            this.DirectionLabel.Text = "Direction: north";
            this.DirectionLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
            //
            // BasePanel
            //
            this.BasePanel.Controls.Add(this.FrameImage);
            this.BasePanel.Dock = System.Windows.Forms.DockStyle.Fill;
            this.BasePanel.Location = new System.Drawing.Point(0, 23);
            this.BasePanel.Name = "BasePanel";
            this.BasePanel.Size = new System.Drawing.Size(224, 156);
            this.BasePanel.TabIndex = 4;
            //
            // BaseEditor
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(52)))), ((int)(((byte)(54)))), ((int)(((byte)(75)))));
            this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
            this.Controls.Add(this.BasePanel);
            this.Controls.Add(this.DirectionLabel);
            this.Controls.Add(this.BaseStatusStrip);
            this.DoubleBuffered = true;
            this.Name = "BaseEditor";
            this.Size = new System.Drawing.Size(224, 203);
            this.Resize += new System.EventHandler(this.BaseEditor_Resize);
            this.BaseStatusStrip.ResumeLayout(false);
            this.BaseStatusStrip.PerformLayout();
            this.BasePanel.ResumeLayout(false);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private SphereStudio.UI.SnapPanel FrameImage;
        private System.Windows.Forms.StatusStrip BaseStatusStrip;
        private System.Windows.Forms.ToolStripStatusLabel XYLabel;
        private System.Windows.Forms.ToolStripStatusLabel WHLabel;
        private SphereStudio.UI.DialogHeader DirectionLabel;
        private System.Windows.Forms.Panel BasePanel;
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--

    Licensed to the Apache Software Foundation (ASF) under one
    or more contributor license agreements. See the NOTICE file
    distributed with this work for additional information
    regarding copyright ownership. The ASF licenses this file
    to you under the Apache License, Version 2.0 (the
    "License"); you may not use this file except in compliance
    with the License.  You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>

	<parent>
		<groupId>org.apache.commons</groupId>
		<artifactId>commons-rdf-parent</artifactId>
		<version>0.4.0-SNAPSHOT</version>
	</parent>

	<artifactId>commons-rdf-rdf4j</artifactId>
	<packaging>jar</packaging>

	<name>Commons RDF impl: RDF4j</name>
	<description>Eclipse RDF4j implementation of Commons RDF API</description>

	<build>
		<plugins>
			<plugin>

				<groupId>org.apache.felix</groupId>
				<artifactId>maven-bundle-plugin</artifactId>
				<configuration>
					<instructions>
						<!-- Not sure why this is needed, .impl and .internal is normally hidden
							by the Bundle Plugin.. -->

						<Export-Package>org.apache.commons.rdf.rdf4j</Export-Package>
						<Private-Package>org.apache.commons.rdf.rdf4j.impl</Private-Package>
					</instructions>
				</configuration>
			</plugin>
		</plugins>
	</build>

    <distributionManagement>
      <site>
        <id>commonsrdf-api-site</id>
        <url>scm:svn:${commons.scmPubUrl}/rdf4j/</url>
      </site>
    </distributionManagement>

	<dependencies>
		<dependency>
			<groupId>${project.parent.groupId}</groupId>
			<artifactId>commons-rdf-api</artifactId>
			<version>${project.version}</version>
		</dependency>
		<dependency>
			<groupId>${project.parent.groupId}</groupId>
			<artifactId>commons-rdf-simple</artifactId>
			<version>${project.version}</version>
		</dependency>

		<!-- Selected rdf4j dependencies We don't use rdf4j-runtime or rdf4j-runtime-osgi
			here, as they pull in various depenencies like lucene, which might not be
			needed. -->

		<dependency>
			<groupId>org.eclipse.rdf4j</groupId>
			<artifactId>rdf4j-model</artifactId>
		</dependency>
		<dependency>
			<groupId>org.eclipse.rdf4j</groupId>
			<artifactId>rdf4j-repository-api</artifactId>
		</dependency>

		<!-- For RDF4JParser, these are the RIO dependencies for the standard
			RDF 1.1 languages -->
		<dependency>
			<groupId>org.eclipse.rdf4j</groupId>
			<artifactId>rdf4j-rio-turtle</artifactId>
		</dependency>
		<dependency>
			<groupId>org.eclipse.rdf4j</groupId>
			<artifactId>rdf4j-rio-ntriples</artifactId>
		</dependency>
		<dependency>
			<groupId>org.eclipse.rdf4j</groupId>
			<artifactId>rdf4j-rio-nquads</artifactId>
		</dependency>
		<dependency>
			<groupId>org.eclipse.rdf4j</groupId>
			<artifactId>rdf4j-rio-rdfxml</artifactId>
		</dependency>
		<dependency>
			<groupId>org.eclipse.rdf4j</groupId>
			<artifactId>rdf4j-rio-trig</artifactId>
		</dependency>
		<dependency>
			<groupId>org.eclipse.rdf4j</groupId>
			<artifactId>rdf4j-rio-jsonld</artifactId>
		</dependency>
		<!-- Languages notably missing, and why:

		rdf4j-rio-rdfjson: standard, but https://www.w3.org/TR/rdf-json/ says:
			"The syntax defined in this document should not be used unless there is a specific reason to do so"

		rdf4j-rio-binary: non-standard

		rdf4j-rio-n3: unofficial standard, super-seeded by Turtle

		rdf4j-rio-trix: unofficial standard
		-->

		<!-- There are multiple RDF4J sail/repository implementations, we use the
			below from RDF4JFactory. -->
		<dependency>
			<groupId>org.eclipse.rdf4j</groupId>
			<artifactId>rdf4j-sail-memory</artifactId>
		</dependency>
		<dependency>
			<groupId>org.eclipse.rdf4j</groupId>
			<artifactId>rdf4j-repository-sail</artifactId>
		</dependency>
		<!--  and nativerdf for testing -->
		<dependency>
			<groupId>org.eclipse.rdf4j</groupId>
			<artifactId>rdf4j-sail-nativerdf</artifactId>
			<scope>test</scope>
		</dependency>

		<dependency>
			<groupId>${project.parent.groupId}</groupId>
			<artifactId>commons-rdf-api</artifactId>
			<version>${project.version}</version>
			<classifier>tests</classifier>
			<scope>test</scope>
		</dependency>
	</dependencies>

	<!-- Ensure consistent rdf4j versions across the board -->
	<dependencyManagement>
		<dependencies>
			<dependency>
				<groupId>org.eclipse.rdf4j</groupId>
				<artifactId>rdf4j-bom</artifactId>
				<version>${rdf4j.version}</version>
				<type>pom</type>
				<scope>import</scope>
			</dependency>
		</dependencies>
	</dependencyManagement>

</project>


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Lecanora lateritia Lindau

### Remarks
null


text:
package testing

import (
	"os/exec"

	gc "gopkg.in/check.v1"
)

// CleanupSuite adds the ability to add cleanup functions that are called
// during either test tear down or suite tear down depending on the method
// called.
type CleanupSuite struct {
	testStack    []func(*gc.C)
	suiteStack   []func(*gc.C)
	origSuite    *CleanupSuite
	testsStarted bool
	inTest       bool
	tornDown     bool
}

func (s *CleanupSuite) SetUpSuite(c *gc.C) {
	s.suiteStack = nil
	s.testStack = nil
	s.origSuite = s
	s.testsStarted = false
	s.inTest = false
	s.tornDown = false
}

func (s *CleanupSuite) TearDownSuite(c *gc.C) {
	s.callStack(c, s.suiteStack)
	s.suiteStack = nil
	s.origSuite = nil
	s.tornDown = true
}

func (s *CleanupSuite) SetUpTest(c *gc.C) {
	s.testStack = nil
	s.testsStarted = true
	s.inTest = true
}

func (s *CleanupSuite) TearDownTest(c *gc.C) {
	s.callStack(c, s.testStack)
	s.testStack = nil
	s.inTest = false
}

func (s *CleanupSuite) callStack(c *gc.C, stack []func(*gc.C)) {
	for i := len(stack) - 1; i >= 0; i-- {
		stack[i](c)
	}
}

// AddCleanup pushes the cleanup function onto the stack of functions to be
// called during TearDownTest or TearDownSuite. TearDownTest will be used if
// SetUpTest has already been called, else we will use TearDownSuite
func (s *CleanupSuite) AddCleanup(cleanup func(*gc.C)) {
	if s.origSuite == nil {
		// This is either called before SetUpSuite or after
		// TearDownSuite. Either way, we can't really trust that we're
		// going to call Cleanup correctly.
		if s.tornDown {
			panic("unsafe to call AddCleanup after TearDownSuite")
		} else {
			panic("unsafe to call AddCleanup before SetUpSuite")
		}
	}
	if s != s.origSuite {
		// If you write a test like:
		// func (s MySuite) TestFoo(c *gc.C) {
		//   s.AddCleanup(foo)
		// }
		// The AddCleanup call is unsafe because it modifes
		// s.origSuite but that object disappears once TestFoo
		// returns. So you have to use:
		// func (s *MySuite) TestFoo(c *gc.C) if you want the Cleanup
		// funcs.
		panic("unsafe to call AddCleanup from non pointer receiver test")
	}
	if !s.inTest {
		if s.testsStarted {
			// This indicates that we are not currently in a test
			// (inTest is false), but that we have already run a
			// test for this test suite (testStarted is true).
			// Making a Suite-level change here means that only
			// some of the tests in the suite will see the change,
			// which means it *isn't* a Suite (applies to all
			// tests) level change.
			panic("unsafe to call AddCleanup after a test has been torn down" +
				" before a new test has been set up" +
				" (Suite level changes only make sense before first test is run)")
		}
		// We either haven't called SetUpTest or we've already called
		// TearDownTest, consider this a Suite level cleanup.
		s.suiteStack = append(s.suiteStack, cleanup)
		return
	}
	s.testStack = append(s.testStack, cleanup)
}

// PatchEnvironment sets the environment variable 'name' the the value passed
// in. The old value is saved and returned to the original value at test tear
// down time using a cleanup function.
func (s *CleanupSuite) PatchEnvironment(name, value string) {
	restore := PatchEnvironment(name, value)
	s.AddCleanup(func(*gc.C) { restore() })
}

// PatchEnvPathPrepend prepends the given path to the environment $PATH and restores the
// original path on test teardown.
func (s *CleanupSuite) PatchEnvPathPrepend(dir string) {
	restore := PatchEnvPathPrepend(dir)
	s.AddCleanup(func(*gc.C) { restore() })
}

// PatchValue sets the 'dest' variable the the value passed in. The old value
// is saved and returned to the original value at test tear down time using a
// cleanup function. The value must be assignable to the element type of the
// destination.
func (s *CleanupSuite) PatchValue(dest, value interface{}) {
	restore := PatchValue(dest, value)
	s.AddCleanup(func(*gc.C) { restore() })
}

// HookCommandOutput calls the package function of the same name to mock out
// the result of a particular comand execution, and will call the restore
// function on test teardown.
func (s *CleanupSuite) HookCommandOutput(
	outputFunc *func(cmd *exec.Cmd) ([]byte, error),
	output []byte,
	err error,
) <-chan *exec.Cmd {
	result, restore := HookCommandOutput(outputFunc, output, err)
	s.AddCleanup(func(*gc.C) { restore() })
	return result
}