text:
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { CommonModule } from '@angular/common';
import { HttpClientModule } from '@angular/common/http';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';

import { NgbModule, NgbDateParserFormatter, NgbDatepickerI18n } from '@ng-bootstrap/ng-bootstrap';
import { ToastrModule, ToastrService } from 'ngx-toastr';

import { UsedMaterialModule } from '../../shared/used-material.module';
import { InflexibilityPeriodListComponent } from './inflexibility-period-list.component';
import { InflexibilityPeriodsModule } from '../inflexibility-periods.module';
import { InflexibilityPeriodsService } from '../../service/inflexibility-periods.service';
import { NgbDateITParserFormatter } from '../../shared/ngb-date-it-parser-formatter';
import { I18n, ItalianDatepickerI18n } from '../../shared/italianDatepickerI18n';
import { EmployeAutocompleteModule } from '../../employe-autocomplete/employe-autocomplete.module';
import { inflexibilityPeriodListMock } from '../../shared/tests-mocks/mocks';
import { Employe } from '../../shared/dto/employe';
import { ApplicationSharedData } from '../../shared/application-shared-data';

let inflexibilityPeriodsService: InflexibilityPeriodsService;
const inflexibilityPeriod = inflexibilityPeriodListMock[0];
const employes = <Employe[]>inflexibilityPeriodListMock[0].employes.concat(inflexibilityPeriodListMock[1].employes);

describe('InflexibilityPeriodListComponent', () => {
  let component: InflexibilityPeriodListComponent;
  let fixture: ComponentFixture<InflexibilityPeriodListComponent>;

  beforeEach(async(() => {
    TestBed.configureTestingModule({
      providers: [
        ToastrService,
        InflexibilityPeriodsService,
        { provide: NgbDateParserFormatter, useClass: NgbDateITParserFormatter },
        I18n,
        { provide: NgbDatepickerI18n, useClass: ItalianDatepickerI18n }
      ],
      imports: [
        CommonModule,
        BrowserAnimationsModule,
        HttpClientModule,
        FormsModule,
        ReactiveFormsModule,
        NgbModule.forRoot(),
        ToastrModule.forRoot(),
        EmployeAutocompleteModule,
        InflexibilityPeriodsModule,
        UsedMaterialModule,
      ]
    })
      .compileComponents();
  }));

  beforeEach(async () => {
    fixture = TestBed.createComponent(InflexibilityPeriodListComponent);
    component = fixture.componentInstance;
    inflexibilityPeriodsService = fixture.debugElement.injector.get(InflexibilityPeriodsService);

    const spyGetInflexibilityPeriods = spyOn(inflexibilityPeriodsService, 'getInflexibilityPeriods')
      .and.returnValue(Promise.resolve(inflexibilityPeriodListMock));
    const spySaveInflexibilityPeriod = spyOn(inflexibilityPeriodsService, 'saveInflexibilityPeriod')
      .and.returnValue(Promise.resolve(inflexibilityPeriod));
    const spyDeleteInflexibilityPeriod = spyOn(inflexibilityPeriodsService, 'deleteInflexibilityPeriod')
      .and.returnValue(Promise.resolve(inflexibilityPeriod));
    const spyGetInflexibilityPeriodsMot = spyOn(inflexibilityPeriodsService, 'getMotivations')
      .and.returnValue(Promise.resolve([inflexibilityPeriod.inflexibilityPeriodMotivation]));
    fixture.detectChanges();
    component.employeAutocomplete.employesSubject.next(employes);
    fixture.detectChanges();
  });

  it('should be created', async () => {
    expect(component).toBeTruthy();
  });

  it('Trigger form validation.', () => {
    component.inflexibilityPeriodForm.markAsTouched();
    fixture.detectChanges();
    const response = component['isFormInvalid'].call(component);
    fixture.detectChanges();
    expect(response).toBe(true, 'Form validation should return true');
    expect(component.inflexibilityPeriodForm.errors.arrayEmpty).toBe(true, 'Form validation should generate array empty error');
    expect(component.inflexibilityPeriodForm.errors.motivationEmpty).toBe(true, 'Form validation should generate motivationEmpty error');
  });

  it('Trigger inflexibilityPeriod edit.', () => {
    fixture.detectChanges();
    expect(function () {
      component['editInflexibilityPeriod'].call(component, inflexibilityPeriod);
    }).not.toThrow();
  });

  it('Trigger inflexibilityPeriod save.', () => {
    fixture.detectChanges();
    expect(function () {
      component['saveInflexibilityPeriod'].call(component, inflexibilityPeriod);
    }).not.toThrow();
  });

  it('Trigger inflexibilityPeriod delete.', () => {
    fixture.detectChanges();
    expect(function () {
      component['deleteInflexibilityPeriod'].call(component, inflexibilityPeriod);
    }).not.toThrow();
  });

  it('Select employe.', () => {
    component.employeAutocomplete.employeCtrl.setValue('name');
    fixture.detectChanges();
    component['selectedEmploye'].call(component, employes[0]);
    fixture.whenStable().then(() => {
      expect(component.inflexibilityPeriodModel.employes.length).toBe(1);
    });
  });

  it('Select motivation.', () => {
    component.motivationAutocomplete.motivationCtrl.setValue('R');
    fixture.detectChanges();
    component['selectedMotivation'].call(component, inflexibilityPeriod.inflexibilityPeriodMotivation);
    fixture.whenStable().then(() => {
      expect(component.inflexibilityPeriodModel.inflexibilityPeriodMotivation.description).toBe('Rilascio');
    });
  });

  it('Reset motivation.', () => {
    component.motivationAutocomplete.motivationCtrl.setValue('R');
    fixture.detectChanges();
    component['resetMotivation'].call(component);
    fixture.whenStable().then(() => {
      expect(component.inflexibilityPeriodModel.inflexibilityPeriodMotivation).toBe(undefined);
    });
  });
});


text:
'use strict';

var assign = require('object-assign');
var GoogleAuth = require('google-auth-library');

function Auth(config) {
  if (!(this instanceof Auth)) {
    return new Auth(config);
  }

  this.authClient = null;
  this.config = config || {};
}

Auth.prototype.authorizeRequest = function (reqOpts, callback) {
  this.getToken(function (err, token) {
    if (err) {
      callback(err);
      return;
    }

    var authorizedReqOpts = assign({}, reqOpts);
    authorizedReqOpts.headers = authorizedReqOpts.headers || {};
    authorizedReqOpts.headers.Authorization = 'Bearer ' + token;

    callback(null, authorizedReqOpts);
  });
};

Auth.prototype.getToken = function (callback) {
  this._getClient(function (err, client) {
    if (err) {
      callback(err);
      return;
    }

    client.getAccessToken(callback);
  });
};

Auth.prototype._getClient = function (callback) {
  var self = this;
  var config = self.config;

  if (this.authClient) {
    setImmediate(function () {
      callback(null, self.authClient);
    });

    return;
  }

  var googleAuth = new GoogleAuth();

  if (config.keyFilename || config.keyFile) {
    var authClient = new googleAuth.JWT();
    authClient.keyFile = config.keyFilename || config.keyFile;
    authClient.email = config.email;
    authClient.scopes = config.scopes;
    addScope(null, authClient);
  } else if (config.credentials) {
    googleAuth.fromJSON(config.credentials, addScope);
  } else {
    googleAuth.getApplicationDefault(addScope);
  }

  function addScope(err, authClient) {
    if (err) {
      callback(err);
      return;
    }

    if (authClient.createScopedRequired && authClient.createScopedRequired()) {
      if (!config.scopes) {
        var scopeError = new Error('Scopes are required for this request.');
        scopeError.code = 'MISSING_SCOPE';
        callback(scopeError);
        return;
      }

      authClient = authClient.createScoped(config.scopes);
    }

    self.authClient = authClient;
    callback(null, authClient);
  }
};

module.exports = Auth;

redpajama_set_name: RedPajamaGithub


text:
#pragma once
#include <aws/swf/SWF_EXPORTS.h>
#include <aws/swf/model/ActivityTaskTimeoutType.h>
#include <aws/core/utils/memory/stl/AWSString.h>

namespace Aws
{
namespace Utils
{
namespace Json
{
  class JsonValue;
} // namespace Json
} // namespace Utils
namespace SWF
{
namespace Model
{
  /*

Provides details of the ActivityTaskTimedOut event.

  */
  class AWS_SWF_API ActivityTaskTimedOutEventAttributes
  {
  public:
    ActivityTaskTimedOutEventAttributes();
    ActivityTaskTimedOutEventAttributes(const Aws::Utils::Json::JsonValue& jsonValue);
    ActivityTaskTimedOutEventAttributes& operator=(const Aws::Utils::Json::JsonValue& jsonValue);
    Aws::Utils::Json::JsonValue Jsonize() const;

    /*

The type of the timeout that caused this event.

    */
    inline const ActivityTaskTimeoutType& GetTimeoutType() const{ return m_timeoutType; }

    /*

The type of the timeout that caused this event.

    */
    inline void SetTimeoutType(const ActivityTaskTimeoutType& value) { m_timeoutTypeHasBeenSet = true; m_timeoutType = value; }

    /*

The type of the timeout that caused this event.

    */
    inline void SetTimeoutType(ActivityTaskTimeoutType&& value) { m_timeoutTypeHasBeenSet = true; m_timeoutType = value; }

    /*

The type of the timeout that caused this event.

    */
    inline ActivityTaskTimedOutEventAttributes& WithTimeoutType(const ActivityTaskTimeoutType& value) { SetTimeoutType(value); return *this;}

    /*

The type of the timeout that caused this event.

    */
    inline ActivityTaskTimedOutEventAttributes& WithTimeoutType(ActivityTaskTimeoutType&& value) { SetTimeoutType(value); return *this;}

    /*

The ID of the ActivityTaskScheduled event that was recorded when this activity task was scheduled. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.

    */
    inline long long GetScheduledEventId() const{ return m_scheduledEventId; }

    /*

The ID of the ActivityTaskScheduled event that was recorded when this activity task was scheduled. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.

    */
    inline void SetScheduledEventId(long long value) { m_scheduledEventIdHasBeenSet = true; m_scheduledEventId = value; }

    /*

The ID of the ActivityTaskScheduled event that was recorded when this activity task was scheduled. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.

    */
    inline ActivityTaskTimedOutEventAttributes& WithScheduledEventId(long long value) { SetScheduledEventId(value); return *this;}

    /*

The ID of the ActivityTaskStarted event recorded when this activity task was started. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.

    */
    inline long long GetStartedEventId() const{ return m_startedEventId; }

    /*

The ID of the ActivityTaskStarted event recorded when this activity task was started. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.

    */
    inline void SetStartedEventId(long long value) { m_startedEventIdHasBeenSet = true; m_startedEventId = value; }

    /*

The ID of the ActivityTaskStarted event recorded when this activity task was started. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.

    */
    inline ActivityTaskTimedOutEventAttributes& WithStartedEventId(long long value) { SetStartedEventId(value); return *this;}

    /*

Contains the content of the details parameter for the last call made by the activity to RecordActivityTaskHeartbeat.

    */
    inline const Aws::String& GetDetails() const{ return m_details; }

    /*

Contains the content of the details parameter for the last call made by the activity to RecordActivityTaskHeartbeat.

    */
    inline void SetDetails(const Aws::String& value) { m_detailsHasBeenSet = true; m_details = value; }

    /*

Contains the content of the details parameter for the last call made by the activity to RecordActivityTaskHeartbeat.

    */
    inline void SetDetails(Aws::String&& value) { m_detailsHasBeenSet = true; m_details = value; }

    /*

Contains the content of the details parameter for the last call made by the activity to RecordActivityTaskHeartbeat.

    */
    inline void SetDetails(const char* value) { m_detailsHasBeenSet = true; m_details.assign(value); }

    /*

Contains the content of the details parameter for the last call made by the activity to RecordActivityTaskHeartbeat.

    */
    inline ActivityTaskTimedOutEventAttributes& WithDetails(const Aws::String& value) { SetDetails(value); return *this;}

    /*

Contains the content of the details parameter for the last call made by the activity to RecordActivityTaskHeartbeat.

    */
    inline ActivityTaskTimedOutEventAttributes& WithDetails(Aws::String&& value) { SetDetails(value); return *this;}

    /*

Contains the content of the details parameter for the last call made by the activity to RecordActivityTaskHeartbeat.

    */
    inline ActivityTaskTimedOutEventAttributes& WithDetails(const char* value) { SetDetails(value); return *this;}

  private:
    ActivityTaskTimeoutType m_timeoutType;
    bool m_timeoutTypeHasBeenSet;
    long long m_scheduledEventId;
    bool m_scheduledEventIdHasBeenSet;
    long long m_startedEventId;
    bool m_startedEventIdHasBeenSet;
    Aws::String m_details;
    bool m_detailsHasBeenSet;
  };

} // namespace Model
} // namespace SWF
} // namespace Aws


text:
package com.fillumina.performance.producer.progression;

import org.junit.Test;

/**
 *
 * @author Francesco Illuminati
 */
public class InstrumenterNullInstrumentableTest {

    @Test(expected = IllegalStateException.class)
    public void shouldProgressionPerformanceInstrumenterCheckNullInstrumentable() {
        final ProgressionPerformanceInstrumenter instrumenter =
                ProgressionPerformanceInstrumenter.builder()
                    .setBaseAndMagnitude(10, 1)
                    .build();

        instrumenter.execute();
    }

    @Test(expected = IllegalStateException.class)
    public void shouldAutoProgressionPerformanceInstrumenterCheckNullInstrumentable() {
        final AutoProgressionPerformanceInstrumenter instrumenter =
                AutoProgressionPerformanceInstrumenter.builder()
                    .setMaxStandardDeviation(7)
                    .build();

        instrumenter.execute();
    }
}


text:
ACCEPTED

#### According to
International Plant Names Index

#### Published in
null

#### Original name
Erlangea vernonioides Muschl.

### Remarks
null


text:
PetPuller
=========

PetPuller


text:
package com.spring.mybank.user.controller;

import static org.junit.Assert.*;

import org.junit.Before;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

public class UserControllerTest {

	@Autowired
	UserController userController;

	@Before
	public void setUp() throws Exception {
	}

	@Test
	public void testCreatUser() {

	}

}


text:
'use strict';

/* jasmine specs */

describe('AppCtrl', function(){
  beforeEach(module('myApp'));

  var AppCtrl, scope, httpBackend;

  beforeEach(inject(function($controller, $rootScope, $httpBackend) {
    scope = $rootScope.$new();
    AppCtrl = $controller('AppCtrl', {
      $scope: scope
    });
    httpBackend = $httpBackend;
    httpBackend.when('GET', 'data/cities.json').respond(200);
  }));

  afterEach(function() {
    httpBackend.flush();
    httpBackend.verifyNoOutstandingExpectation();
    httpBackend.verifyNoOutstandingRequest();
  });

  it('should fetch datas', function () {
    httpBackend.expectGET('data/cities.json').respond(200);
  });

  it('should define default scope value', function () {
    expect(scope.sort).toBe('name');
    expect(scope.order).toBe('false');
  });

  it('should clear the query field', function () {
    scope.query = 'something';
    scope.clearField();
    expect(scope.query).toBe('');
  });

  it('should display the right city', function () {
    expect(scope.cityDetails).toBeUndefined();

    var city = {
      name: "Amsterdam",
      slug: "amsterdam",
      count: 25,
      content: "
Amsterdam is the capital and most populous city of the Netherlands. Its status as the Dutch capital is mandated by the Constitution of the Netherlands though it is not the seat of the Dutch government, which is at the Hague.
"
    };
    scope.view(city);

    expect(scope.cityDetails).toBe(city);
  });

  it('should have a column filter working', inject(function($filter){
    var array = [
      'value 1',
      'value 2',
      'value 3',
      'value 4',
      'value 5'
    ];

    var result = [];
    result.push(['value 1', 'value 2']);
    result.push(['value 3', 'value 4']);
    result.push(['value 5']);

    var filter = $filter('columns')(array, 3);

    expect(filter).toEqual(result);
  }));
});


text:
using System;

namespace Mocking.Utils
{
    public class EmailUtils
    {
        public static bool SendEmail(string message)
        {
            Console.WriteLine($"I totally sent that email: {message}");
            return true;
        }
    }
}


text:
<?php

namespace GoPague;

class Store extends Resource
{
    public static function all()
    {
        return static::requestAll('stores');
    }
}


text:
int lll_central_iso_init(void);
int lll_central_iso_reset(void);
void lll_central_iso_prepare(void *param);


text:
<?xml version="1.0" ?>
<coverage branch-rate="0" branches-covered="0" branches-valid="0" complexity="0" line-rate="0.875" lines-covered="7" lines-valid="8" timestamp="1593434652245" version="5.1">
	<!-- Generated by coverage.py: https://coverage.readthedocs.io -->
	<!-- Based on https://raw.githubusercontent.com/cobertura/web/master/htdocs/xml/coverage-04.dtd -->
	<sources>
		<source>/home/ec2-user/pycobertura/tests/dummy.uncovered/dummy</source>
	</sources>
	<packages>
		<package branch-rate="0" complexity="0" line-rate="0.875" name=".">
			<classes>
				<class branch-rate="0" complexity="0" filename="__init__.py" line-rate="1" name="__init__.py">
					<methods/>
					<lines/>
				</class>
				<class branch-rate="0" complexity="0" filename="dummy.py" line-rate="0.875" name="dummy.py">
					<methods/>
					<lines>
						<line hits="1" number="1"/>
						<line hits="1" number="2"/>
						<line hits="1" number="4"/>
						<line hits="1" number="5"/>
						<line hits="0" number="6"/>
						<line hits="1" number="7"/>
						<line hits="1" number="9"/>
						<line hits="1" number="10"/>
					</lines>
				</class>
			</classes>
		</package>
	</packages>
</coverage>


text:
package org.apache.flink.table.planner.plan.nodes.physical.batch

import org.apache.flink.api.common.io.InputFormat
import org.apache.flink.api.dag.Transformation
import org.apache.flink.runtime.operators.DamBehavior
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment
import org.apache.flink.streaming.api.functions.source.InputFormatSourceFunction
import org.apache.flink.table.data.RowData
import org.apache.flink.table.planner.delegation.BatchPlanner
import org.apache.flink.table.planner.plan.nodes.common.CommonPhysicalTableSourceScan
import org.apache.flink.table.planner.plan.nodes.exec.{BatchExecNode, ExecNode}
import org.apache.flink.table.planner.plan.schema.TableSourceTable
import org.apache.flink.table.runtime.typeutils.InternalTypeInfo

import org.apache.calcite.plan._
import org.apache.calcite.rel.RelNode
import org.apache.calcite.rel.metadata.RelMetadataQuery

import java.util

import scala.collection.JavaConversions._

/**
  * Batch physical RelNode to read data from an external source defined by a
  * bounded [[org.apache.flink.table.connector.source.ScanTableSource]].
  */
class BatchExecTableSourceScan(
    cluster: RelOptCluster,
    traitSet: RelTraitSet,
    tableSourceTable: TableSourceTable)
  extends CommonPhysicalTableSourceScan(cluster, traitSet, tableSourceTable)
  with BatchPhysicalRel
  with BatchExecNode[RowData]{

  override def copy(traitSet: RelTraitSet, inputs: util.List[RelNode]): RelNode = {
    new BatchExecTableSourceScan(cluster, traitSet, tableSourceTable)
  }

  override def computeSelfCost(planner: RelOptPlanner, mq: RelMetadataQuery): RelOptCost = {
    val rowCnt = mq.getRowCount(this)
    if (rowCnt == null) {
      return null
    }
    val cpu = 0
    val rowSize = mq.getAverageRowSize(this)
    val size = rowCnt * rowSize
    planner.getCostFactory.makeCost(rowCnt, cpu, size)
  }

  //~ ExecNode methods -----------------------------------------------------------

  override def getDamBehavior: DamBehavior = DamBehavior.PIPELINED

  override def getInputNodes: util.List[ExecNode[BatchPlanner, _]] = List()

  override def replaceInputNode(
      ordinalInParent: Int,
      newInputNode: ExecNode[BatchPlanner, _]): Unit = {
    replaceInput(ordinalInParent, newInputNode.asInstanceOf[RelNode])
  }

  override protected def createInputFormatTransformation(
      env: StreamExecutionEnvironment,
      inputFormat: InputFormat[RowData, _],
      name: String,
      outTypeInfo: InternalTypeInfo[RowData]): Transformation[RowData] = {
    // env.createInput will use ContinuousFileReaderOperator, but it do not support multiple
    // paths. If read partitioned source, after partition pruning, we need let InputFormat
    // to read multiple partitions which are multiple paths.
    // We can use InputFormatSourceFunction directly to support InputFormat.
    val func = new InputFormatSourceFunction[RowData](inputFormat, outTypeInfo)
    ExecNode.setManagedMemoryWeight(env.addSource(func, name, outTypeInfo).getTransformation)
  }

  override protected def translateToPlanInternal(
      planner: BatchPlanner): Transformation[RowData] = {
    createSourceTransformation(planner.getExecEnv, getRelDetailedDescription)
  }
}


text:
package com.github.maven_nar.cpptasks.borland;

import com.github.maven_nar.cpptasks.CCTask;
import com.github.maven_nar.cpptasks.CUtil;
import com.github.maven_nar.cpptasks.compiler.CommandLineLinker;
import com.github.maven_nar.cpptasks.compiler.CommandLineLinkerConfiguration;
import com.github.maven_nar.cpptasks.compiler.LinkType;
import com.github.maven_nar.cpptasks.compiler.Linker;
import com.github.maven_nar.cpptasks.types.LibraryTypeEnum;

import java.io.File;
import java.io.IOException;
import java.util.Vector;

import org.apache.tools.ant.BuildException;

/**
 * Adapter for the Borland(r) tlib Librarian
 *
 * @author Curt Arnold
 */
public class BorlandLibrarian extends CommandLineLinker {
    private static final BorlandLibrarian instance = new BorlandLibrarian();
    public static BorlandLibrarian getInstance() {
        return instance;
    }
    private BorlandLibrarian() {
        super("tlib", "--version", new String[]{".obj"}, new String[0], ".lib", false,
                null);
    }
    protected String getCommandFileSwitch(String cmdFile) {
        //
        //  tlib requires quotes around paths containing -
        //     ilink32 doesn't like them
        StringBuffer buf = new StringBuffer("@");
        BorlandProcessor.quoteFile(buf, cmdFile);
        return buf.toString();
    }
    public File[] getLibraryPath() {
        return CUtil.getPathFromEnvironment("LIB", ";");
    }
    public String[] getLibraryPatterns(String[] libnames, LibraryTypeEnum libType) {
        return BorlandProcessor.getLibraryPatterns(libnames, libType);
    }
    public Linker getLinker(LinkType type) {
        return BorlandLinker.getInstance().getLinker(type);
    }
    public int getMaximumCommandLength() {
        return 1024;
    }
    public String[] getOutputFileSwitch(String outFile) {
        return BorlandProcessor.getOutputFileSwitch(outFile);
    }
    public boolean isCaseSensitive() {
        return BorlandProcessor.isCaseSensitive();
    }
    /**
     * Gets identifier for the linker.
     *
     * TLIB will lockup when attempting to get version
     * information.  Since the Librarian version isn't critical
     * just return a stock response.
     */
    public String getIdentifier() {
    	return "TLIB 4.5 Copyright (c) 1987, 1999 Inprise Corporation";
    }

    /**
     * Prepares argument list for exec command.
     *
     * @param outputDir linker output directory
     * @param outputName linker output name
     * @param sourceFiles
     *            linker input files (.obj, .o, .res)
     * @param config
     *            linker configuration
     * @return arguments for runTask
     */
    protected String[] prepareArguments(
    		CCTask task,
    		String outputDir,
			String outputName,
            String[] sourceFiles,
			CommandLineLinkerConfiguration config) {
    	String[] preargs = config.getPreArguments();
        String[] endargs = config.getEndArguments();
        StringBuffer buf = new StringBuffer();
        Vector<String> execArgs = new Vector<String>(preargs.length + endargs.length + 10
                + sourceFiles.length);

        execArgs.addElement(this.getCommand());
        String outputFileName = new File(outputDir, outputName).toString();
        execArgs.addElement(quoteFilename(buf, outputFileName));

        for (int i = 0; i < preargs.length; i++) {
            execArgs.addElement(preargs[i]);
        }

        //
        //   add a place-holder for page size
        //
        int pageSizeIndex = execArgs.size();
        execArgs.addElement(null);

        int objBytes = 0;

        for (int i = 0; i < sourceFiles.length; i++) {
            String last4 = sourceFiles[i]
                    .substring(sourceFiles[i].length() - 4).toLowerCase();
            if (last4.equals(".def")) {
            } else {
                if (last4.equals(".res")) {
                } else {
                    if (last4.equals(".lib")) {
                    } else {
                        execArgs.addElement("+" + quoteFilename(buf, sourceFiles[i]));
                        objBytes += new File(sourceFiles[i]).length();
                    }
                }
            }
        }

        for (int i = 0; i < endargs.length; i++) {
            execArgs.addElement(endargs[i]);
        }

        String[] execArguments = new String[execArgs.size()];
        execArgs.copyInto(execArguments);

    	int minPageSize = objBytes >> 16;
    	int pageSize = 0;
    	for(int i = 4; i <= 15; i++) {
    		pageSize = 1 << i;
    		if (pageSize > minPageSize) break;
    	}
        execArguments[pageSizeIndex] = "/P" + Integer.toString(pageSize);

        return execArguments;
    }

    /**
     * Prepares argument list to execute the linker using a response file.
     *
     * @param outputFile
     *            linker output file
     * @param args
     *            output of prepareArguments
     * @return arguments for runTask
     */
    protected String[] prepareResponseFile(File outputFile, String[] args)
            throws IOException {
    	String[] cmdargs = BorlandProcessor.prepareResponseFile(outputFile, args, " & \n");
        cmdargs[cmdargs.length - 1] = getCommandFileSwitch(cmdargs[cmdargs.length -1]);
        return cmdargs;
    }

    /**
     * Builds a library
     *
     */
    public void link(CCTask task,
                     File outputFile,
                     String[] sourceFiles,
                     CommandLineLinkerConfiguration config)
                     throws BuildException
    {
    	//
    	//  delete any existing library
    	outputFile.delete();
    	//
    	//  build a new library
    	super.link(task, outputFile, sourceFiles, config);
    }

    /**
     *   Encloses problematic file names within quotes.
     *   @param buf string buffer
     *   @param filename source file name
     *   @return filename potentially enclosed in quotes.
     */
    protected String quoteFilename(StringBuffer buf,String filename) {
      buf.setLength(0);
      BorlandProcessor.quoteFile(buf, filename);
      return buf.toString();
    }

}


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

<hsdoc version="1.1.0">
  <info cname="系统公用"/>
  <extendMap>
    <entity>
      <key>CresModuleExtendProperty</key>
      <value><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
<cresextend:CresMoudleExtendProperty xmlns:cresextend="http://www.hundsun.com/ares/studio/cres/extend/1.0.0" subSysID="3" dataBaseName="USERDB"/>
]]></value>
    </entity>
  </extendMap>
</hsdoc>


text:
<!DOCTYPE html>

  <link href="http://gmpg.org/xfn/11" rel="profile">
  <meta charset="UTF-8">

	<meta name="description" content="Landing Page for the blog">

	<meta name="author" content="Andy Tran">

  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">

  <title>

      Abdel Raoof's Blog · Hello, this is Andy

  </title>

  <link rel="stylesheet" href="http://xanadhi.github.io//assets/css/bootstrap.css">
  <link rel="stylesheet" href="http://xanadhi.github.io//assets/css/app.css">
  <link rel="stylesheet" href="http://xanadhi.github.io//assets/css/github.css">
  <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">

  <link href='http://fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,400,700' rel='stylesheet' type='text/css'>
  <link href='http://fonts.googleapis.com/css?family=Slabo+13px' rel='stylesheet' type='text/css'>

  <link rel="apple-touch-icon-precomposed" sizes="128x128" href="http://xanadhi.github.io//assets/images/favicon-128.png">
  <link rel="shortcut icon" href="http://xanadhi.github.io//assets/images/favicon-16.ico">

  <link rel="alternate" type="application/rss+xml" title="RSS" href="/feed.xml">

            About

            Resume

            Blog

            Tags

            Archive

                    Peep Phonebook

                   PUBLISHED ON November 09, 2014

                    Another Sharepoint post

                   PUBLISHED ON July 07, 2014

                			SharePoint

                			Designer

                    Markdown basics

                   PUBLISHED ON June 24, 2014

                			Design

                			Markdown

                    Another sample markdown

                   PUBLISHED ON June 24, 2014

                			Design

                			Markdown

                    A Sample pangram

                   PUBLISHED ON June 23, 2014

                			Sample

                			Pangram

                    Welcome to Jekyll!

                   PUBLISHED ON December 11, 2013

                			Welcome

                			Jekyll

                			Update

                			First

                    Clearing SharePoint Designer Cache

                   PUBLISHED ON October 11, 2013

                			SharePoint

                			Designer

                    Cannot Connect to PerformancePoint Service

                   PUBLISHED ON April 20, 2013

                			SharePoint

                			PerformancePoint Service

                    ← Older

                    Newer →

            © 2015 - Andy Tran. All rights reserved

            Built using

            Jekyll


text:
<?php

declare(strict_types=1);

namespace Sylius\Behat\Page\Shop\Account\Order;

use FriendsOfBehat\PageObjectExtension\Page\SymfonyPageInterface;

interface ShowPageInterface extends SymfonyPageInterface
{
    /**
     * @return string
     */
    public function getNumber();

    /**
     * @param string $customerName
     * @param string $street
     * @param string $postcode
     * @param string $city
     * @param string $countryName
     *
     * @return bool
     */
    public function hasShippingAddress($customerName, $street, $postcode, $city, $countryName);

    /**
     * @param string $customerName
     * @param string $street
     * @param string $postcode
     * @param string $city
     * @param string $countryName
     *
     * @return bool
     */
    public function hasBillingAddress($customerName, $street, $postcode, $city, $countryName);

    public function getOrderShipmentStatus(): string;

    /**
     * @return string
     */
    public function getTotal();

    /**
     * @return string
     */
    public function getSubtotal();

    public function getShipmentStatus(): string;

    /**
     * @return int
     */
    public function countItems();

    /**
     * @return string
     */
    public function getPaymentPrice();

    public function getPaymentStatus(): string;

    public function getOrderPaymentStatus(): string;

    public function isProductInTheList(string $productName): bool;

    /**
     * @return string
     */
    public function getItemPrice();

    /**
     * @param string $provinceName
     *
     * @return bool
     */
    public function hasShippingProvinceName($provinceName);

    /**
     * @param string $provinceName
     *
     * @return bool
     */
    public function hasBillingProvinceName($provinceName);
}


text:
struct ImGui_ImplSDLRenderer_Data
{
    SDL_Renderer*   SDLRenderer;
    SDL_Texture*    FontTexture;
    ImGui_ImplSDLRenderer_Data() { memset((void*)this, 0, sizeof(*this)); }
};

// Backend data stored in io.BackendRendererUserData to allow support for multiple Dear ImGui contexts
// It is STRONGLY preferred that you use docking branch with multi-viewports (== single Dear ImGui context + multiple windows) instead of multiple Dear ImGui contexts.
static ImGui_ImplSDLRenderer_Data* ImGui_ImplSDLRenderer_GetBackendData()
{
    return ImGui::GetCurrentContext() ? (ImGui_ImplSDLRenderer_Data*)ImGui::GetIO().BackendRendererUserData : NULL;
}

// Functions
bool ImGui_ImplSDLRenderer_Init(SDL_Renderer* renderer)
{
    ImGuiIO& io = ImGui::GetIO();
    IM_ASSERT(io.BackendRendererUserData == NULL && "Already initialized a renderer backend!");
    IM_ASSERT(renderer != NULL && "SDL_Renderer not initialized!");

    // Setup backend capabilities flags
    ImGui_ImplSDLRenderer_Data* bd = IM_NEW(ImGui_ImplSDLRenderer_Data)();
    io.BackendRendererUserData = (void*)bd;
    io.BackendRendererName = "imgui_impl_sdlrenderer";
    io.BackendFlags |= ImGuiBackendFlags_RendererHasVtxOffset;  // We can honor the ImDrawCmd::VtxOffset field, allowing for large meshes.

    bd->SDLRenderer = renderer;

    return true;
}

void ImGui_ImplSDLRenderer_Shutdown()
{
    ImGui_ImplSDLRenderer_Data* bd = ImGui_ImplSDLRenderer_GetBackendData();
    IM_ASSERT(bd != NULL && "No renderer backend to shutdown, or already shutdown?");
    ImGuiIO& io = ImGui::GetIO();

    ImGui_ImplSDLRenderer_DestroyDeviceObjects();

    io.BackendRendererName = NULL;
    io.BackendRendererUserData = NULL;
    IM_DELETE(bd);
}

static void ImGui_ImplSDLRenderer_SetupRenderState()
{
	ImGui_ImplSDLRenderer_Data* bd = ImGui_ImplSDLRenderer_GetBackendData();

	// Clear out any viewports and cliprect set by the user
    // FIXME: Technically speaking there are lots of other things we could backup/setup/restore during our render process.
	SDL_RenderSetViewport(bd->SDLRenderer, NULL);
	SDL_RenderSetClipRect(bd->SDLRenderer, NULL);
}

void ImGui_ImplSDLRenderer_NewFrame()
{
    ImGui_ImplSDLRenderer_Data* bd = ImGui_ImplSDLRenderer_GetBackendData();
    IM_ASSERT(bd != NULL && "Did you call ImGui_ImplSDLRenderer_Init()?");

    if (!bd->FontTexture)
        ImGui_ImplSDLRenderer_CreateDeviceObjects();
}

void ImGui_ImplSDLRenderer_RenderDrawData(ImDrawData* draw_data)
{
	ImGui_ImplSDLRenderer_Data* bd = ImGui_ImplSDLRenderer_GetBackendData();

	// If there's a scale factor set by the user, use that instead
    // If the user has specified a scale factor to SDL_Renderer already via SDL_RenderSetScale(), SDL will scale whatever we pass
    // to SDL_RenderGeometryRaw() by that scale factor. In that case we don't want to be also scaling it ourselves here.
    float rsx = 1.0f;
	float rsy = 1.0f;
	SDL_RenderGetScale(bd->SDLRenderer, &rsx, &rsy);
    ImVec2 render_scale;
	render_scale.x = (rsx == 1.0f) ? draw_data->FramebufferScale.x : 1.0f;
	render_scale.y = (rsy == 1.0f) ? draw_data->FramebufferScale.y : 1.0f;

	// Avoid rendering when minimized, scale coordinates for retina displays (screen coordinates != framebuffer coordinates)
	int fb_width = (int)(draw_data->DisplaySize.x * render_scale.x);
	int fb_height = (int)(draw_data->DisplaySize.y * render_scale.y);
	if (fb_width == 0 || fb_height == 0)
		return;

    // Backup SDL_Renderer state that will be modified to restore it afterwards
    struct BackupSDLRendererState
    {
        SDL_Rect    Viewport;
        bool        ClipEnabled;
        SDL_Rect    ClipRect;
    };
    BackupSDLRendererState old = {};
    old.ClipEnabled = SDL_RenderIsClipEnabled(bd->SDLRenderer) == SDL_TRUE;
    SDL_RenderGetViewport(bd->SDLRenderer, &old.Viewport);
    SDL_RenderGetClipRect(bd->SDLRenderer, &old.ClipRect);

	// Will project scissor/clipping rectangles into framebuffer space
	ImVec2 clip_off = draw_data->DisplayPos;         // (0,0) unless using multi-viewports
	ImVec2 clip_scale = render_scale;

    // Render command lists
    ImGui_ImplSDLRenderer_SetupRenderState();
    for (int n = 0; n < draw_data->CmdListsCount; n++)
    {
        const ImDrawList* cmd_list = draw_data->CmdLists[n];
        const ImDrawVert* vtx_buffer = cmd_list->VtxBuffer.Data;
        const ImDrawIdx* idx_buffer = cmd_list->IdxBuffer.Data;

        for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++)
        {
            const ImDrawCmd* pcmd = &cmd_list->CmdBuffer[cmd_i];
            if (pcmd->UserCallback)
            {
                // User callback, registered via ImDrawList::AddCallback()
                // (ImDrawCallback_ResetRenderState is a special callback value used by the user to request the renderer to reset render state.)
                if (pcmd->UserCallback == ImDrawCallback_ResetRenderState)
                    ImGui_ImplSDLRenderer_SetupRenderState();
                else
                    pcmd->UserCallback(cmd_list, pcmd);
            }
            else
            {
                // Project scissor/clipping rectangles into framebuffer space
                ImVec2 clip_min((pcmd->ClipRect.x - clip_off.x) * clip_scale.x, (pcmd->ClipRect.y - clip_off.y) * clip_scale.y);
                ImVec2 clip_max((pcmd->ClipRect.z - clip_off.x) * clip_scale.x, (pcmd->ClipRect.w - clip_off.y) * clip_scale.y);
                if (clip_min.x < 0.0f) { clip_min.x = 0.0f; }
                if (clip_min.y < 0.0f) { clip_min.y = 0.0f; }
                if (clip_max.x > fb_width) { clip_max.x = (float)fb_width; }
                if (clip_max.y > fb_height) { clip_max.y = (float)fb_height; }
                if (clip_max.x <= clip_min.x || clip_max.y <= clip_min.y)
                    continue;

                SDL_Rect r = { (int)(clip_min.x), (int)(clip_min.y), (int)(clip_max.x - clip_min.x), (int)(clip_max.y - clip_min.y) };
                SDL_RenderSetClipRect(bd->SDLRenderer, &r);

                const float* xy = (const float*)((const char*)(vtx_buffer + pcmd->VtxOffset) + IM_OFFSETOF(ImDrawVert, pos));
                const float* uv = (const float*)((const char*)(vtx_buffer + pcmd->VtxOffset) + IM_OFFSETOF(ImDrawVert, uv));
#if SDL_VERSION_ATLEAST(2,0,19)
                const SDL_Color* color = (const SDL_Color*)((const char*)(vtx_buffer + pcmd->VtxOffset) + IM_OFFSETOF(ImDrawVert, col)); // SDL 2.0.19+
#else
                const int* color = (const int*)((const char*)(vtx_buffer + pcmd->VtxOffset) + IM_OFFSETOF(ImDrawVert, col)); // SDL 2.0.17 and 2.0.18
#endif

                // Bind texture, Draw
				SDL_Texture* tex = (SDL_Texture*)pcmd->GetTexID();
                SDL_RenderGeometryRaw(bd->SDLRenderer, tex,
                    xy, (int)sizeof(ImDrawVert),
                    color, (int)sizeof(ImDrawVert),
                    uv, (int)sizeof(ImDrawVert),
                    cmd_list->VtxBuffer.Size - pcmd->VtxOffset,
                    idx_buffer + pcmd->IdxOffset, pcmd->ElemCount, sizeof(ImDrawIdx));
            }
        }
    }

    // Restore modified SDL_Renderer state
    SDL_RenderSetViewport(bd->SDLRenderer, &old.Viewport);
    SDL_RenderSetClipRect(bd->SDLRenderer, old.ClipEnabled ? &old.ClipRect : NULL);
}

// Called by Init/NewFrame/Shutdown
bool ImGui_ImplSDLRenderer_CreateFontsTexture()
{
    ImGuiIO& io = ImGui::GetIO();
    ImGui_ImplSDLRenderer_Data* bd = ImGui_ImplSDLRenderer_GetBackendData();

    // Build texture atlas
    unsigned char* pixels;
    int width, height;
    io.Fonts->GetTexDataAsRGBA32(&pixels, &width, &height);   // Load as RGBA 32-bit (75% of the memory is wasted, but default font is so small) because it is more likely to be compatible with user's existing shaders. If your ImTextureId represent a higher-level concept than just a GL texture id, consider calling GetTexDataAsAlpha8() instead to save on GPU memory.

    // Upload texture to graphics system
    // (Bilinear sampling is required by default. Set 'io.Fonts->Flags |= ImFontAtlasFlags_NoBakedLines' or 'style.AntiAliasedLinesUseTex = false' to allow point/nearest sampling)
    bd->FontTexture = SDL_CreateTexture(bd->SDLRenderer, SDL_PIXELFORMAT_ABGR8888, SDL_TEXTUREACCESS_STATIC, width, height);
    if (bd->FontTexture == NULL)
    {
        SDL_Log("error creating texture");
        return false;
    }
    SDL_UpdateTexture(bd->FontTexture, NULL, pixels, 4 * width);
    SDL_SetTextureBlendMode(bd->FontTexture, SDL_BLENDMODE_BLEND);
    SDL_SetTextureScaleMode(bd->FontTexture, SDL_ScaleModeLinear);

    // Store our identifier
    io.Fonts->SetTexID((ImTextureID)(intptr_t)bd->FontTexture);

    return true;
}

void ImGui_ImplSDLRenderer_DestroyFontsTexture()
{
    ImGuiIO& io = ImGui::GetIO();
    ImGui_ImplSDLRenderer_Data* bd = ImGui_ImplSDLRenderer_GetBackendData();
    if (bd->FontTexture)
    {
        io.Fonts->SetTexID(0);
        SDL_DestroyTexture(bd->FontTexture);
        bd->FontTexture = NULL;
    }
}

bool ImGui_ImplSDLRenderer_CreateDeviceObjects()
{
    return ImGui_ImplSDLRenderer_CreateFontsTexture();
}

void ImGui_ImplSDLRenderer_DestroyDeviceObjects()
{
    ImGui_ImplSDLRenderer_DestroyFontsTexture();
}


text:
#ifndef UTILS_MOLECULARDYNAMICS_H
#define UTILS_MOLECULARDYNAMICS_H

#include <Core/Interfaces/Calculator.h>
#include <Core/Interfaces/CalculatorWithReference.h>
#include <Utils/CalculatorBasics/Results.h>
#include <Utils/MolecularTrajectory.h>
#include <Utils/Typenames.h>
#include <boost/optional.hpp>

namespace Scine {

namespace Core {
struct Log;
}

namespace Utils {
class MDIntegrator;
class Results;
class Settings;
class AtomCollection;

class MolecularDynamics {
 public:
  /**
   * @brief Constructor that takes in a reference to a calculator.
   */
  explicit MolecularDynamics(Core::Calculator& calculator);
  /**
   * @brief Constructor that takes in a reference to a calculator with a reference calculator.
   */
  explicit MolecularDynamics(Core::CalculatorWithReference& calculatorWithReference);
  /**
   * @brief Performs an MD simulation with the set calculator and the current settings.
   * @param structure The initial molecular structure.
   */
  void performMDSimulation(const AtomCollection& structure, Core::Log& log);
  /**
   * @brief Getter for the molecular trajectory.
   *
   *        The molecular trajectory holds the structures and energies along the MD simulation.
   *        The first element is always the initial structure with its energy.
   */
  Utils::MolecularTrajectory getMolecularTrajectory() const;
  /**
   * @brief Getter for the velocities corresponding to the structures in the molecular trajectory of the MD simulation.
   * @return std::vector<Utils::DisplacementCollection> The velocities.
   */
  std::vector<Utils::DisplacementCollection> getVelocities() const;
  /**
   * @brief Getter for the last velocities encountered during the MD simulation.
   * @note These velocities can be different from the last element of the velocities obtainable via getVelocities() if
   * the record frequency is not one.
   * @return Utils::DisplacementCollection The velocities.
   */
  Utils::DisplacementCollection getFinalVelocities() const;
  /**
   * @brief Getter for the temperatures corresponding to the structures in the molecular trajectory of the MD simulation.
   * @return const std::vector<double> The temperatures in Kelvin.
   */
  std::vector<double> getTemperatures() const;
  /**
   * @brief Sets initial velocities for the MD simulation.
   */
  void setInitialVelocities(const Utils::DisplacementCollection& velocities);
  /**
   * @brief Accessor for the settings.
   * @return Utils::Settings& The settings.
   */
  Utils::Settings& settings();
  /**
   * @brief Constant accessor for the settings.
   * @return const Utils::Settings& The settings.
   */
  const Utils::Settings& settings() const;
  /**
   * @brief Setter for the external stop function.
   * @param Function with arguments: current positions, calculation results, number of steps since start of MD.
   */
  void setExternalStop(std::function<bool(const PositionCollection&, const Results&, int)> externalStop);
  /**
   * @brief Setter for the bias potential function.
   * @param Function with arguments: current positions, calculation results, number of steps since start of MD.
   */
  void setBiasPotential(std::function<std::pair<double, GradientCollection>(const PositionCollection&, const Results&, int)> biasPotential);

 private:
  // The settings
  std::unique_ptr<Utils::Settings> settings_;
  // Apply the settings
  void applySettings();
  // Sets the required calculator properties and checks whether all requested ones are available
  void setCalculatorProperties();
  // An optional calculator with reference calculator
  boost::optional<Core::CalculatorWithReference&> calculatorWithReference_;
  // The (reference) calculator
  Core::Calculator& calculator_;
  // Runs a calculation either with the calculator with reference if it exists or directly with the calculator if not
  const Utils::Results& calculateWithCorrectCalculator() const;
  // Returns a unique pointer to a position updater.
  std::unique_ptr<MDIntegrator> getIntegrator() const;
  // The seed for the initial velocity generation
  int generationSeed_;
  // Integration time step in femtoseconds
  double timeStep_;
  // Position updater algorithm
  std::string positionUpdaterAlgorithm_;
  // Initial velocities;
  Utils::DisplacementCollection initialVelocities_;
  // Thermostat algorithm
  std::string thermostatAlgorithm_;
  // Target temperature if coupling to temperature bath is desired
  double targetTemperature_;
  // Temperature for which initial velocities are drawn from a Boltzmann distribution if they are not given explicitly
  double generationTemperature_;
  // The thermostat coupling time in femtoseconds
  double temperatureCouplingTime_;
  // The seed used for stochastic dynamics
  int stochasticDynamicsSeed_;
  // Number of MD steps
  int numberOfSteps_;
  // The molecular trajectory corresponding to the MD simulation (contains structures and energies)
  // The first element is always the initial structure.
  Utils::MolecularTrajectory structures_;
  // Decides whether velocities are recorded
  bool saveVelocities_;
  // Decides whether temperatures are recorded
  bool saveTemperatures_;

  // A vector containing the velocities of each step
  std::vector<Utils::DisplacementCollection> velocities_;
  // The final velocities encountered duting the MD simulation
  // These can be different from velocities_.back() if the record frequency is not one
  Utils::DisplacementCollection finalVelocities_;
  // A vector containing the temperatures of each step in Kelvin
  std::vector<double> temperatures_;
  // The frequency with which the structures of the MD simulations and their energies
  // are saved to the molecular trajectory.
  int recordFrequency_;
  // Number of steps after which to remove the linear and angular momentum, respectively
  // If negative, do not remove.
  int linearMomentumRemovalFrequency_, angularMomentumRemovalFrequency_;
  // The external stop function.
  std::function<bool(const PositionCollection&, const Results&, int)> externalStop_ = nullptr;
  // The bias potential.
  std::function<std::pair<double, GradientCollection>(const PositionCollection&, const Results&, int)> biasPotential_ = nullptr;
};

} // namespace Utils
} // namespace Scine

#endif // UTILS_MOLECULARDYNAMICS_H


text:
using System;
using System.Collections;
using System.Collections.Generic;

namespace Advanced.Algorithms.DataStructures.Foundation
{
    /// <summary>
    /// A sorted HashSet implementation using balanced binary search tree. IEnumerable will enumerate in sorted order.
    /// This may be better than regular HashSet implementation which can give o(K) in worst case (but O(1) amortized when collisions K is avoided).
    /// </summary>
    /// <typeparam name="T">The value datatype.</typeparam>
    public class OrderedHashSet<T> : IEnumerable<T> where T : IComparable
    {
        //use red-black tree as our balanced BST since it gives good performance for both deletion/insertion
        private readonly RedBlackTree<T> binarySearchTree;

        public int Count => binarySearchTree.Count;

        public OrderedHashSet()
        {
            binarySearchTree = new RedBlackTree<T>();
        }

        /// <summary>
        /// Initialize the sorted hashset with given sorted key collection.
        /// Time complexity: log(n).
        /// </summary>
        public OrderedHashSet(IEnumerable<T> sortedKeys)
        {
            binarySearchTree = new RedBlackTree<T>(sortedKeys);
        }

        /// <summary>
        ///  Time complexity: O(log(n))
        /// </summary>
        public T this[int index]
        {
            get => ElementAt(index);

        }

        /// <summary>
        /// Does this hash table contains the given value.
        /// Time complexity: O(log(n)).
        /// </summary>
        /// <param name="value">The value to check.</param>
        /// <returns>True if this hashset contains the given value.</returns>
        public bool Contains(T value)
        {
            return binarySearchTree.HasItem(value);
        }

        /// <summary>
        /// Add a new key.
        /// Time complexity: O(log(n)).
        /// Returns the position (index) of the key in sorted order of this OrderedHashSet.
        /// </summary>
        public int Add(T key)
        {
            return binarySearchTree.Insert(key);
        }

        /// <summary>
        ///  Time complexity: O(log(n))
        /// </summary>
        public T ElementAt(int index)
        {
            return binarySearchTree.ElementAt(index);
        }

        /// <summary>
        ///  Time complexity: O(log(n))
        /// </summary>
        public int IndexOf(T key)
        {
            return binarySearchTree.IndexOf(key);
        }

        /// <summary>
        /// Remove the given key if present.
        /// Time complexity: O(log(n)).
        /// Returns the position (index) of the removed key if removed. Otherwise returns -1.
        /// </summary>
        public int Remove(T key)
        {
            return binarySearchTree.Delete(key);
        }

        /// <summary>
        /// Remove the element at given index.
        /// Time complexity: O(log(n)).
        /// </summary>
        public T RemoveAt(int index)
        {
            return binarySearchTree.RemoveAt(index);
        }

        /// <summary>
        /// Return the next higher value after given value in this hashset.
        /// Time complexity: O(log(n)).
        /// </summary>
        /// <returns>Null if the given value does'nt exist or next value does'nt exist.</returns>
        public T NextHigher(T value)
        {
            return binarySearchTree.NextHigher(value);
        }

        /// <summary>
        /// Return the next lower value before given value in this HashSet.
        /// Time complexity: O(log(n)).
        /// </summary>
        /// <returns>Null if the given value does'nt exist or previous value does'nt exist.</returns>
        public T NextLower(T value)
        {
            return binarySearchTree.NextLower(value);
        }

        /// <summary>
        /// Time complexity: O(log(n)).
        /// </summary>
        public T Max()
        {
            return binarySearchTree.Max();
        }

        /// <summary>
        /// Time complexity: O(log(n)).
        /// </summary>
        public T Min()
        {
            return binarySearchTree.Min();
        }

        /// <summary>
        /// Clear the hashtable.
        /// Time complexity: O(1).
        /// </summary>
        internal void Clear()
        {
            binarySearchTree.Clear();
        }

        /// <summary>
        /// Descending enumerable.
        /// </summary>
        public IEnumerable<T> AsEnumerableDesc()
        {
            return GetEnumeratorDesc().AsEnumerable();
        }

        //Implementation for the GetEnumerator method.
        IEnumerator IEnumerable.GetEnumerator()
        {
            return GetEnumerator();
        }

        public IEnumerator<T> GetEnumerator()
        {
            return binarySearchTree.GetEnumerator();
        }

        public IEnumerator<T> GetEnumeratorDesc()
        {
            return binarySearchTree.GetEnumeratorDesc();
        }
    }
}


text:
<!DOCTYPE html>

    <canvas id ="box-1" width="200" height="200"></canvas>

    <canvas id ="box-2" width="200" height="200"></canvas>


text:
layout: post
title: 'Styling Examples'
---

Proin in turpis ac purus sodales tristique non et dui. Donec non magna molestie,
hendrerit ante sed, bibendum nunc. Mauris eleifend vulputate ultricies.

---

Praesent `scelerisque`, diam eget ullamcorper venenatis, velit ipsum mattis
lorem, a laoreet tellus velit eu risus. Curabitur condimentum mauris sit amet
orci dignissim, eget ultrices enim consequat.

> A blockquote!

- Lorem ipsum dolor sit amet
- onsectetur adipiscing elit
- Donec finibus nibh sed dapibus euismod
- Sed tellus velit

1. Lorem ipsum dolor sit amet
1. onsectetur adipiscing elit
1. Donec finibus nibh sed dapibus euismod
1. Sed tellus velit

{% highlight bash %}

$ echo "thing"
thing
{% endhighlight %}

## Header 2

Nunc sed nisi porta, sollicitudin elit nec, hendrerit purus. Maecenas tincidunt
tortor vel nunc elementum convallis. Donec eleifend, ex et convallis bibendum,
neque neque efficitur augue, vitae bibendum nisl massa a libero. Phasellus
fermentum nec magna eu volutpat. Ut imperdiet risus eu leo malesuada, quis
fringilla erat finibus. Sed in laoreet nibh. Mauris pulvinar mattis sagittis.

| Tables        |      Are      |   Cool |
| ------------- | :-----------: | -----: |
| col 3 is      | right-aligned | \$1600 |
| col 2 is      |   centered    |   \$12 |
| zebra stripes |   are neat    |    \$1 |

### Header 3

Suspendisse lacinia elit ut orci facilisis volutpat. Aliquam in ultrices tortor.
Nam vitae magna lobortis, consequat risus quis, elementum nibh. Phasellus
malesuada eros eget faucibus scelerisque. Nullam facilisis eros vel dui rhoncus
euismod. Nunc nibh risus, interdum nec ultricies in, tempor vitae nisi. Etiam
porttitor risus id scelerisque interdum. Morbi tincidunt, nibh sed convallis
eleifend, nibh massa vulputate diam, ut laoreet erat massa sed nisi. Suspendisse
ut malesuada velit, efficitur elementum lacus.

| Markdown | Less      | Pretty     |
| -------- | --------- | ---------- |
| _Still_  | `renders` | **nicely** |
| 1        | 2         | 3          |

#### Header 4

Nullam quis malesuada sapien, ac rutrum arcu. Praesent semper vestibulum purus
vitae dignissim. Donec fringilla pellentesque enim et fringilla. Aliquam
hendrerit dui nunc, id suscipit nibh semper in. Nam a dictum nisi, vitae lacinia
ante. Aliquam dictum eros porttitor, euismod leo at, efficitur augue. Praesent
dignissim placerat malesuada. Nullam dictum ornare risus, vel blandit nulla
imperdiet a. Donec auctor blandit nibh, sollicitudin interdum nisl. Donec lectus
est, posuere id consectetur eu, facilisis sit amet tortor. Nulla quis ornare
neque, sed interdum erat. Praesent mattis egestas lacus et efficitur. Nulla
pharetra lacinia arcu, ac vulputate nibh vestibulum id.

##### Header 5

Integer in rutrum augue, non tincidunt nulla. Vestibulum suscipit ac libero
tincidunt ultricies. Phasellus libero ipsum, volutpat in nisl sed, pellentesque
accumsan elit. Morbi in elementum ligula. In sit amet maximus arcu. Proin quis
rhoncus ex. Mauris gravida nulla eros, ut interdum nisi pulvinar a.

###### Header 6

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec finibus nibh sed
dapibus euismod. Sed tellus velit, ornare nec euismod sit amet, mollis in odio.
Suspendisse vel fringilla lacus. Nam dignissim euismod turpis in cursus. Quisque
sit amet risus sit amet mauris vulputate fringilla a ac eros. Sed iaculis augue
nibh, quis ultrices erat dignissim sit amet.


text:
<?php

namespace app\models;

use Yii;
use yii\behaviors\TimestampBehavior;
use yii\web\UploadedFile;
use yii\helpers\FileHelper;
use yii\db\ActiveRecord;

/**
 * This is the model class for table "noticia".
 *
 * @property integer $id
 * @property integer $id_autor
 * @property string $nome_autor
 * @property string $titulo
 * @property string $introducao
 * @property string $imagem
 * @property string $corpo
 * @property string $fonte
 * @property string $tags
 * @property string $status
 * @property integer $visitas
 * @property string $created_at
 * @property string $updated_at
 * @property string $updated_by
 *
 * @property Users $idAutor
 * @property NoticiaDestaque[] $noticiaDestaques
 * @property NoticiaPertenceCategoria[] $noticiaPertenceCategorias
 * @property NoticiaCategoria[] $idNoticiaCategorias
 */
class Noticia extends ActiveRecord
{
    public $image_file;
    public $timeago;

    const STATUS_INACTIVE = 'Inativo';
    const STATUS_ACTIVE = 'Ativo';

    /**
     * @inheritdoc
     */
    public function behaviors()
    {
        return [
            TimestampBehavior::className(),
        ];
    }

    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'noticia';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['id_autor',
              'nome_autor',
              'titulo',
              'introducao',
              'corpo',
             ],
             'required'
            ],
            [['status'], 'required'],
            [['image_file'], 'required', 'on' => 'insert'],
            [['id_autor', 'visitas'], 'integer'],
            [['introducao', 'corpo', 'status'], 'string'],
            [['created_at', 'updated_at', 'timeago'], 'safe'],
            [['nome_autor'], 'string', 'max' => 100],
            [['titulo', 'imagem', 'fonte', 'tags'], 'string', 'max' => 250]
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'id_autor' => 'ID autor',
            'nome_autor' => 'Nome do autor',
            'titulo' => 'Título',
            'introducao' => 'Introdução',
            'imagem' => 'Imagem',
            'corpo' => 'Corpo',
            'fonte' => 'Fonte',
            'tags' => 'Tags',
            'status' => 'Status',
            'visitas' => 'Visualizações',
            'created_at' => 'Criado em',
            'updated_at' => 'Atualizado em',
        ];
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getAutor()
    {
        return $this->hasOne(Users::className(), ['id' => 'id_autor']);
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getNoticiaDestaques()
    {
        return $this->hasMany(NoticiaDestaque::className(), ['id_noticia' => 'id']);
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getNoticiaPertenceCategorias()
    {
        return $this->hasMany(NoticiaPertenceCategoria::className(), ['id_noticia' => 'id']);
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getNoticiaCategorias()
    {
        return $this->hasMany(NoticiaCategoria::className(), ['id' => 'id_noticia_categoria'])->viaTable('noticia_pertence_categoria', ['id_noticia' => 'id']);
    }

    /**
     * @inheritdoc
     * @return NoticiaQuery the active query used by this AR class.
     */
    public static function find()
    {
        return new NoticiaQuery(get_called_class());
    }

    public function uploadImagem()
    {
        if ($this->validate()) {
            if ($this->image_file != null) {
                # Cria o diretório se não existir
                FileHelper::createDirectory('uploads/img/noticias / ');
                $file = explode(' . ', $this->image_file->name);
                $this->image_file->saveAs(\Yii::getAlias('@webroot/uploads/img/noticias/') . $file[0] . ' - ' . date('YmdHis') . ' . ' . $this->image_file->extension);

                return $file[0] . ' - ' . date('YmdHis') . ' . ' . $this->image_file->extension;
            }
        } else {
            return false;
        }
    }

    public function getNoticiaActive()
    {
        return $this::find()->where(['status' => Noticia::STATUS_ACTIVE])->orderBy(['created_at' => SORT_DESC])->all();
    }

    public function afterFind()
    {
        parent::afterFind();

        $this->timeago = self::TimeAgo($this->created_at);
    }

    static function TimeAgo($time)
    {
        $time = time() - $time; // to get the time since that moment
        $time = ($time < 1) ? 1 : $time;
        $tokens = [
            31536000 => 'ano',
            2592000 => 'mes',
            604800 => 'semana',
            86400 => 'dia',
            3600 => 'hora',
            60 => 'minuto',
            1 => 'segundo'
        ];

        foreach ($tokens as $unit => $text) {
            if ($time < $unit) continue;
            $numberOfUnits = floor($time / $unit);

            return $numberOfUnits . ' ' . $text . (($numberOfUnits > 1) ? 's' : '');
        }
    }
}


text:
/** @file open.cpp Test cases to open KVs in the CFSTORE using the drv->Open() interface.
 *
 * Please consult the documentation under the test-case functions for
 * a description of the individual test case.
 */

#include "mbed.h"
#include "cfstore_config.h"
#include "cfstore_test.h"
#include "cfstore_debug.h"
#include "Driver_Common.h"
#include "configuration_store.h"
#include "utest/utest.h"
#include "unity/unity.h"
#include "greentea-client/test_env.h"
#include "cfstore_utest.h"
#ifdef YOTTA_CFG_CFSTORE_UVISOR
#include "uvisor-lib/uvisor-lib.h"
#endif /* YOTTA_CFG_CFSTORE_UVISOR */

#include <stdio.h>
#include <string.h>
#include <stdlib.h>     /*rand()*/
#include <inttypes.h>

using namespace utest::v1;

static char cfstore_open_utest_msg_g[CFSTORE_UTEST_MSG_BUF_SIZE];

/* Configure secure box. */
#ifdef YOTTA_CFG_CFSTORE_UVISOR
UVISOR_BOX_NAMESPACE("com.arm.mbed.cfstore.test.open.box1");
UVISOR_BOX_CONFIG(cfstore_open_box1, UVISOR_BOX_STACK_SIZE);
#endif /* YOTTA_CFG_CFSTORE_UVISOR */

/// @cond CFSTORE_DOXYGEN_DISABLE
#ifdef CFSTORE_DEBUG
#define CFSTORE_OPEN_GREENTEA_TIMEOUT_S     3000
#else
#define CFSTORE_OPEN_GREENTEA_TIMEOUT_S     1000
#endif
/// @endcond

/* support functions */

/*
 * open tests that focus on testing cfstore_open()
 * cfstore_handle_t cfstore_open(const char* key_name, char* data, ARM_CFSTORE_SIZE* len, cfstore_key_desc_t* kdesc)
 */

/* KV data for test_01 */
static cfstore_kv_data_t cfstore_open_test_01_kv_data[] = {
        { "yotta.hello-world.animal{wobbly-dog}{foot}frontLeft", "missing"},
        { NULL, NULL},
};

/* report whether built/configured for flash sync or async mode */
static control_t cfstore_open_test_00(const size_t call_count)
{
    int32_t ret = ARM_DRIVER_ERROR;

    (void) call_count;
    ret = cfstore_test_startup();
    CFSTORE_TEST_UTEST_MESSAGE(cfstore_open_utest_msg_g, CFSTORE_UTEST_MSG_BUF_SIZE, "%s:Error: failed to perform test startup (ret=%d).\n", __func__, (int) ret);
    TEST_ASSERT_MESSAGE(ret >= ARM_DRIVER_OK, cfstore_open_utest_msg_g);
    return CaseNext;
}

/** @brief
 * Basic open test which does the following:
 * - creates KV with default rw perms and writes some data to the value blob.
 * - closes the newly created KV.
 * - opens the KV with the default permissions (r-only)
 * - reads the KV data and checks its the same as the previously created data.
 * - closes the opened key
 *
 * @return on success returns CaseNext to continue to next test case, otherwise will assert on errors.
 */
control_t cfstore_open_test_01_end(const size_t call_count)
{
    char* read_buf;
    int32_t ret = ARM_DRIVER_ERROR;
    ARM_CFSTORE_SIZE len = 0;
    ARM_CFSTORE_DRIVER* drv = &cfstore_driver;
    ARM_CFSTORE_KEYDESC kdesc;
    ARM_CFSTORE_HANDLE_INIT(hkey);
    cfstore_kv_data_t *node;
    ARM_CFSTORE_FMODE flags;

    CFSTORE_DBGLOG("%s:entered\n", __func__);
    (void) call_count;
    node = cfstore_open_test_01_kv_data;
    memset(&kdesc, 0, sizeof(kdesc));
    memset(&flags, 0, sizeof(flags));

    kdesc.drl = ARM_RETENTION_WHILE_DEVICE_ACTIVE;
    CFSTORE_DBGLOG("%s:About to create new node (key_name=\"%s\", value=\"%s\")\n", __func__, node->key_name, node->value);
    ret = drv->Create(node->key_name, strlen(node->value), &kdesc, hkey);
    CFSTORE_TEST_UTEST_MESSAGE(cfstore_open_utest_msg_g, CFSTORE_UTEST_MSG_BUF_SIZE, "%s:Error: failed to create node (key_name=\"%s\", value=\"%s\")(ret=%d)\n", __func__, node->key_name, node->value, (int) ret);
    TEST_ASSERT_MESSAGE(ret >= ARM_DRIVER_OK, cfstore_open_utest_msg_g);

    CFSTORE_DBGLOG("%s:length of KV=%d (key_name=\"%s\", value=\"%s\")\n", __func__, (int) len, node->key_name, node->value);
    len = strlen(node->value);
    ret = drv->Write(hkey, (char*) node->value, &len);
    CFSTORE_TEST_UTEST_MESSAGE(cfstore_open_utest_msg_g, CFSTORE_UTEST_MSG_BUF_SIZE, "%s:Error: failed to write key (key_name=\"%s\", value=\"%s\")(ret=%d)\n", __func__, node->key_name, node->value, (int) ret);
    TEST_ASSERT_MESSAGE(ret >= ARM_DRIVER_OK, cfstore_open_utest_msg_g);

    CFSTORE_TEST_UTEST_MESSAGE(cfstore_open_utest_msg_g, CFSTORE_UTEST_MSG_BUF_SIZE, "%s:Error: failed to write full value data (key_name=\"%s\", value=\"%s\"), len=%d, (ret=%d)\n", __func__, node->key_name, node->value, (int) len, (int) ret);
    TEST_ASSERT_MESSAGE(len == strlen(node->value), cfstore_open_utest_msg_g);

    CFSTORE_DBGLOG("Created KV successfully (key_name=\"%s\", value=\"%s\")\n", node->key_name, node->value);
    ret = drv->Close(hkey);
    CFSTORE_TEST_UTEST_MESSAGE(cfstore_open_utest_msg_g, CFSTORE_UTEST_MSG_BUF_SIZE, "%s:Error: failed to close handle (ret=%d)\n", __func__, (int) ret);
    TEST_ASSERT_MESSAGE(ret >= ARM_DRIVER_OK, cfstore_open_utest_msg_g);

    /* now open the newly created key */
    ret = drv->Open(node->key_name, flags, hkey);
    CFSTORE_TEST_UTEST_MESSAGE(cfstore_open_utest_msg_g, CFSTORE_UTEST_MSG_BUF_SIZE, "%s:Error: failed to open node (key_name=\"%s\", value=\"%s\")(ret=%d)\n", __func__, node->key_name, node->value, (int) ret);
    TEST_ASSERT_MESSAGE(ret >= ARM_DRIVER_OK, cfstore_open_utest_msg_g);

    len = strlen(node->value) + 1;
    read_buf = (char*) malloc(len);
    CFSTORE_TEST_UTEST_MESSAGE(cfstore_open_utest_msg_g, CFSTORE_UTEST_MSG_BUF_SIZE, "%s:Error: failed to allocated read buffer \n", __func__);
    TEST_ASSERT_MESSAGE(read_buf != NULL, cfstore_open_utest_msg_g);

    CFSTORE_DBGLOG("Opened KV successfully (key_name=\"%s\", value=\"%s\")\n", node->key_name, node->value);
    memset(read_buf, 0, len);
    ret = drv->Read(hkey, read_buf, &len);
    CFSTORE_TEST_UTEST_MESSAGE(cfstore_open_utest_msg_g, CFSTORE_UTEST_MSG_BUF_SIZE, "%s:Error: failed to write key (key_name=\"%s\", value=\"%s\")\n", __func__, node->key_name, node->value);
    TEST_ASSERT_MESSAGE(ret >= ARM_DRIVER_OK, cfstore_open_utest_msg_g);

    /* check read data is as expected */
    CFSTORE_TEST_UTEST_MESSAGE(cfstore_open_utest_msg_g, CFSTORE_UTEST_MSG_BUF_SIZE, "%s:Error: read value data (%s) != KV value data (key_name=\"%s\", value=\"%s\")\n", __func__, read_buf, node->key_name, node->value);
    TEST_ASSERT_MESSAGE(strncmp(read_buf, node->value, strlen(node->value)) == 0, cfstore_open_utest_msg_g);

    if(read_buf){
        free(read_buf);
    }
    CFSTORE_TEST_UTEST_MESSAGE(cfstore_open_utest_msg_g, CFSTORE_UTEST_MSG_BUF_SIZE, "%s:Error: Close() call failed.\n", __func__);
    TEST_ASSERT_MESSAGE(drv->Close(hkey) >= ARM_DRIVER_OK, cfstore_open_utest_msg_g);

    ret = drv->Uninitialize();
    CFSTORE_TEST_UTEST_MESSAGE(cfstore_open_utest_msg_g, CFSTORE_UTEST_MSG_BUF_SIZE, "%s:Error: Uninitialize() call failed.\n", __func__);
    TEST_ASSERT_MESSAGE(ret >= ARM_DRIVER_OK, cfstore_open_utest_msg_g);
    return CaseNext;
}

static cfstore_kv_data_t cfstore_open_test_02_data[] = {
        CFSTORE_INIT_1_TABLE_MID_NODE,
        { NULL, NULL},
};

/**
 * @brief   test to open() a pre-existing key and try to write it, which should fail
 *          as by default pre-existing keys are opened read-only
 *
 * Basic open test which does the following:
 * - creates KV with default rw perms and writes some data to the value blob.
 * - closes the newly created KV.
 * - opens the KV with the default permissions (read-only)
 * - tries to write the KV data which should fail because KV was not opened with write flag set.
 * - closes the opened key
 *
 * @return on success returns CaseNext to continue to next test case, otherwise will assert on errors.
 */
control_t cfstore_open_test_02_end(const size_t call_count)
{
    int32_t ret = ARM_DRIVER_ERROR;
    ARM_CFSTORE_SIZE len = 0;
    ARM_CFSTORE_DRIVER* drv = &cfstore_driver;
    ARM_CFSTORE_KEYDESC kdesc;
    ARM_CFSTORE_HANDLE_INIT(hkey);
    ARM_CFSTORE_FMODE flags;

    CFSTORE_FENTRYLOG("%s:entered\n", __func__);
    (void) call_count;
    memset(&kdesc, 0, sizeof(kdesc));
    /* dont set any flags to get default settings */
    memset(&flags, 0, sizeof(flags));
    kdesc.drl = ARM_RETENTION_WHILE_DEVICE_ACTIVE;
    len = strlen(cfstore_open_test_02_data[0].value);
    ret = cfstore_test_create(cfstore_open_test_02_data[0].key_name, (char*) cfstore_open_test_02_data[0].value, &len, &kdesc);
    CFSTORE_TEST_UTEST_MESSAGE(cfstore_open_utest_msg_g, CFSTORE_UTEST_MSG_BUF_SIZE, "%s:Error: failed to create KV in store (ret=%d).\n", __func__, (int) ret);
    TEST_ASSERT_MESSAGE(ret >= ARM_DRIVER_OK, cfstore_open_utest_msg_g);

    /* by default, owner of key opens with read-only permissions*/
    ret = drv->Open(cfstore_open_test_02_data[0].key_name, flags, hkey);
    CFSTORE_TEST_UTEST_MESSAGE(cfstore_open_utest_msg_g, CFSTORE_UTEST_MSG_BUF_SIZE, "%s:Error: failed to open node (key_name=\"%s\")(ret=%d)\n", __func__, cfstore_open_test_02_data[0].key_name, (int) ret);
    TEST_ASSERT_MESSAGE(ret >= ARM_DRIVER_OK, cfstore_open_utest_msg_g);

    len = strlen(cfstore_open_test_02_data[0].value);
    ret = drv->Write(hkey, cfstore_open_test_02_data[0].value, &len);
    CFSTORE_TEST_UTEST_MESSAGE(cfstore_open_utest_msg_g, CFSTORE_UTEST_MSG_BUF_SIZE, "%s:Error: call to Write() succeeded when should have failed (key_name=\"%s\")(ret=%d).\n", __func__, cfstore_open_test_02_data[0].key_name, (int) ret);
    TEST_ASSERT_MESSAGE(ret == ARM_CFSTORE_DRIVER_ERROR_KEY_READ_ONLY, cfstore_open_utest_msg_g);

    CFSTORE_TEST_UTEST_MESSAGE(cfstore_open_utest_msg_g, CFSTORE_UTEST_MSG_BUF_SIZE, "%s:Error: Close() call failed.\n", __func__);
    TEST_ASSERT_MESSAGE(drv->Close(hkey) >= ARM_DRIVER_OK, cfstore_open_utest_msg_g);

    ret = drv->Uninitialize();
    CFSTORE_TEST_UTEST_MESSAGE(cfstore_open_utest_msg_g, CFSTORE_UTEST_MSG_BUF_SIZE, "%s:Error: Uninitialize() call failed.\n", __func__);
    TEST_ASSERT_MESSAGE(ret >= ARM_DRIVER_OK, cfstore_open_utest_msg_g);
    return CaseNext;
}

/**
 * @brief   test to open() a pre-existing key and try to write it, which should succeed
 *          because the key was opened read-write permissions explicitly
 *
 * Basic open test which does the following:
 * - creates KV with default rw perms and writes some data to the value blob.
 * - closes the newly created KV.
 * - opens the KV with the rw permissions (non default)
 * - tries to write the KV data which should succeeds because KV was opened with write flag set.
 * - closes the opened key
 *
 * @return on success returns CaseNext to continue to next test case, otherwise will assert on errors.
 */
control_t cfstore_open_test_03_end(const size_t call_count)
{
    int32_t ret = ARM_DRIVER_ERROR;
    ARM_CFSTORE_SIZE len = 0;
    ARM_CFSTORE_DRIVER* drv = &cfstore_driver;
    ARM_CFSTORE_KEYDESC kdesc;
    ARM_CFSTORE_HANDLE_INIT(hkey);
    ARM_CFSTORE_FMODE flags;

    CFSTORE_FENTRYLOG("%s:entered\n", __func__);
    (void) call_count;
    memset(&kdesc, 0, sizeof(kdesc));
    /* dont set any flags to get default settings */
    memset(&flags, 0, sizeof(flags));
    kdesc.drl = ARM_RETENTION_WHILE_DEVICE_ACTIVE;
    len = strlen(cfstore_open_test_02_data[0].value);
    ret = cfstore_test_create(cfstore_open_test_02_data[0].key_name, (char*) cfstore_open_test_02_data[0].value, &len, &kdesc);
    CFSTORE_TEST_UTEST_MESSAGE(cfstore_open_utest_msg_g, CFSTORE_UTEST_MSG_BUF_SIZE, "%s:Error: failed to create KV in store (ret=%d).\n", __func__, (int) ret);
    TEST_ASSERT_MESSAGE(ret >= ARM_DRIVER_OK, cfstore_open_utest_msg_g);

    /* opens with read-write permissions*/
    flags.read = true;
    flags.write = true;
    ret = drv->Open(cfstore_open_test_02_data[0].key_name, flags, hkey);
    CFSTORE_TEST_UTEST_MESSAGE(cfstore_open_utest_msg_g, CFSTORE_UTEST_MSG_BUF_SIZE, "%s:Error: failed to open node (key_name=\"%s\")(ret=%d)\n", __func__, cfstore_open_test_02_data[0].key_name, (int) ret);
    TEST_ASSERT_MESSAGE(ret >= ARM_DRIVER_OK, cfstore_open_utest_msg_g);

    len = strlen(cfstore_open_test_02_data[0].value);
    ret = drv->Write(hkey, cfstore_open_test_02_data[0].value, &len);
    CFSTORE_TEST_UTEST_MESSAGE(cfstore_open_utest_msg_g, CFSTORE_UTEST_MSG_BUF_SIZE, "%s:Error: call to Write() failed when should have succeeded (key_name=\"%s\")(ret=%d).\n", __func__, cfstore_open_test_02_data[0].key_name, (int) ret);
    TEST_ASSERT_MESSAGE(ret >= ARM_DRIVER_OK, cfstore_open_utest_msg_g);

    CFSTORE_TEST_UTEST_MESSAGE(cfstore_open_utest_msg_g, CFSTORE_UTEST_MSG_BUF_SIZE, "%s:Error: Close() call failed.\n", __func__);
    TEST_ASSERT_MESSAGE(drv->Close(hkey) >= ARM_DRIVER_OK, cfstore_open_utest_msg_g);

    ret = drv->Uninitialize();
    CFSTORE_TEST_UTEST_MESSAGE(cfstore_open_utest_msg_g, CFSTORE_UTEST_MSG_BUF_SIZE, "%s:Error: Uninitialize() call failed.\n", __func__);
    TEST_ASSERT_MESSAGE(ret >= ARM_DRIVER_OK, cfstore_open_utest_msg_g);
    return CaseNext;
}

/** @brief  test to call cfstore_open() with a key_name string that exceeds
 *          the maximum length
 *
 * @return on success returns CaseNext to continue to next test case, otherwise will assert on errors.
 */
control_t cfstore_open_test_04_end(const size_t call_count)
{
    char kv_name_good[CFSTORE_KEY_NAME_MAX_LENGTH+1]; /* extra char for terminating null */
    char kv_name_bad[CFSTORE_KEY_NAME_MAX_LENGTH+2];
    int32_t ret = ARM_DRIVER_ERROR;
    ARM_CFSTORE_SIZE len = 0;
    ARM_CFSTORE_DRIVER* drv = &cfstore_driver;
    ARM_CFSTORE_KEYDESC kdesc;
    ARM_CFSTORE_FMODE flags;

    CFSTORE_FENTRYLOG("%s:entered\n", __func__);
    (void) call_count;
    memset(kv_name_good, 0, CFSTORE_KEY_NAME_MAX_LENGTH+1);
    memset(kv_name_bad, 0, CFSTORE_KEY_NAME_MAX_LENGTH+2);
    memset(&kdesc, 0, sizeof(kdesc));
    /* dont set any flags to get default settings */
    memset(&flags, 0, sizeof(flags));

    len = CFSTORE_KEY_NAME_MAX_LENGTH;
    ret = cfstore_test_kv_name_gen(kv_name_good, len);
    CFSTORE_TEST_UTEST_MESSAGE(cfstore_open_utest_msg_g, CFSTORE_UTEST_MSG_BUF_SIZE, "%s:Error: unable to generate kv_name_good.\n", __func__);
    TEST_ASSERT_MESSAGE(ret >= ARM_DRIVER_OK , cfstore_open_utest_msg_g);

    CFSTORE_TEST_UTEST_MESSAGE(cfstore_open_utest_msg_g, CFSTORE_UTEST_MSG_BUF_SIZE, "%s:Error: kv_name_good is not the correct length (len=%d, expected=%d).\n", __func__, (int) strlen(kv_name_good), (int) len);
    TEST_ASSERT_MESSAGE(strlen(kv_name_good) == CFSTORE_KEY_NAME_MAX_LENGTH, cfstore_open_utest_msg_g);

    ret = cfstore_test_create(kv_name_good, kv_name_good, &len, &kdesc);
    CFSTORE_TEST_UTEST_MESSAGE(cfstore_open_utest_msg_g, CFSTORE_UTEST_MSG_BUF_SIZE, "%s:Error: failed to create KV in store for kv_name_good(ret=%d).\n", __func__, (int) ret);
    TEST_ASSERT_MESSAGE(ret >= ARM_DRIVER_OK, cfstore_open_utest_msg_g);

    len = CFSTORE_KEY_NAME_MAX_LENGTH+1;
    ret = cfstore_test_kv_name_gen(kv_name_bad, len);
    CFSTORE_TEST_UTEST_MESSAGE(cfstore_open_utest_msg_g, CFSTORE_UTEST_MSG_BUF_SIZE, "%s:Error: unable to generate kv_name_bad.\n", __func__);
    TEST_ASSERT_MESSAGE(ret >= ARM_DRIVER_OK , cfstore_open_utest_msg_g);

    CFSTORE_TEST_UTEST_MESSAGE(cfstore_open_utest_msg_g, CFSTORE_UTEST_MSG_BUF_SIZE, "%s:Error: kv_name_bad is not the correct length (len=%d, expected=%d).\n", __func__, (int) strlen(kv_name_bad), (int) len);
    TEST_ASSERT_MESSAGE(strlen(kv_name_bad) == CFSTORE_KEY_NAME_MAX_LENGTH+1, cfstore_open_utest_msg_g);

    memset(&kdesc, 0, sizeof(kdesc));
    ret = cfstore_test_create(kv_name_bad, kv_name_bad, &len, &kdesc);
    CFSTORE_TEST_UTEST_MESSAGE(cfstore_open_utest_msg_g, CFSTORE_UTEST_MSG_BUF_SIZE, "%s:Error: created KV in store for kv_name_bad when should have failed(ret=%d).\n", __func__, (int) ret);
    TEST_ASSERT_MESSAGE(ret < ARM_DRIVER_OK, cfstore_open_utest_msg_g);

    ret = drv->Uninitialize();
    CFSTORE_TEST_UTEST_MESSAGE(cfstore_open_utest_msg_g, CFSTORE_UTEST_MSG_BUF_SIZE, "%s:Error: Uninitialize() call failed.\n", __func__);
    TEST_ASSERT_MESSAGE(ret >= ARM_DRIVER_OK, cfstore_open_utest_msg_g);
    return CaseNext;
}

/// @cond CFSTORE_DOXYGEN_DISABLE
typedef struct cfstore_open_kv_name_ascii_node {
    uint32_t code;
    uint32_t f_allowed : 1;
} cfstore_open_kv_name_ascii_node;
/// @endcond

static const uint32_t cfstore_open_kv_name_ascii_table_code_sentinel_g = 256;

/*@brief    table recording ascii character codes permitted in kv names */
static cfstore_open_kv_name_ascii_node cfstore_open_kv_name_ascii_table[] =
{
        {0, false},         /* codes 0-44 not allowed */
        {45, true},         /* codes 45-46 == [-.] allowed */
        {47, false},        /* code 47 not allowed */
        {48, true},         /* codes 48-57 not allowed */
        {58, false},        /* codes 46-64 not allowed */
        {64, true},         /* codes 64-91 allowed [@A-Z] */
        {91, false},        /* code 91-96 not allowed */
        {95, true},         /* code 95 allowed '_' */
        {96, false},        /* codes 96 not allowed */
        {97, true},         /* codes 65-90 allowed [A-Z] and {*/
        {123, false},       /* codes 123 '}' not allowed on its own*/
        {124, false},       /* codes 124 not allowed */
        {125, false},       /* code 125 '}' not allowed on its own*/
        {126, false},       /* codes 126-255 not allowed */
        {cfstore_open_kv_name_ascii_table_code_sentinel_g, false},       /* sentinel */
};

/// @cond CFSTORE_DOXYGEN_DISABLE
enum cfstore_open_kv_name_pos {
    cfstore_open_kv_name_pos_start = 0x0,
    cfstore_open_kv_name_pos_mid,
    cfstore_open_kv_name_pos_end,
    cfstore_open_kv_name_pos_max
};
/// @endcond

/** @brief  test to call cfstore_open() with key_name that in includes
 *          illegal characters
 *          - the character(s) can be at the beginning of the key_name
 *          - the character(s) can be at the end of the key_name
 *          - the character(s) can be somewhere within the key_name string
 *          - a max-length string of random characters (legal and illegal)
 *          - a max-length string of random illegal characters only
 *
 * @return on success returns CaseNext to continue to next test case, otherwise will assert on errors.
 */
control_t cfstore_open_test_05_end(const size_t call_count)
{
    bool f_allowed = false;
    char kv_name[CFSTORE_KEY_NAME_MAX_LENGTH+1];    /* extra char for terminating null */
    uint32_t j = 0;
    int32_t ret = ARM_DRIVER_OK;
    size_t name_len = CFSTORE_KEY_NAME_MAX_LENGTH;
    ARM_CFSTORE_KEYDESC kdesc;
    cfstore_open_kv_name_ascii_node* node = NULL;
    uint32_t pos;
    ARM_CFSTORE_DRIVER* drv = &cfstore_driver;

    CFSTORE_FENTRYLOG("%s:entered\n", __func__);
    (void) call_count;

#ifdef CFSTORE_DEBUG
    /* symbol only used why debug is enabled */
    const char* pos_str = NULL;
#endif

    /* create bad keyname strings with invalid character code at start of keyname */
    node = cfstore_open_kv_name_ascii_table;
    while(node->code !=  cfstore_open_kv_name_ascii_table_code_sentinel_g)
    {
        /* loop over range */
        for(j = node->code; j < (node+1)->code; j++)
        {
            /* set the start, mid, last character of the name to the test char code */
            for(pos = (uint32_t) cfstore_open_kv_name_pos_start; pos < (uint32_t) cfstore_open_kv_name_pos_max; pos++)
            {
                name_len = CFSTORE_KEY_NAME_MAX_LENGTH;
                memset(kv_name, 0, CFSTORE_KEY_NAME_MAX_LENGTH+1);
                memset(&kdesc, 0, sizeof(kdesc));
                kdesc.drl = ARM_RETENTION_WHILE_DEVICE_ACTIVE;

                ret = cfstore_test_kv_name_gen(kv_name, name_len);
                CFSTORE_TEST_UTEST_MESSAGE(cfstore_open_utest_msg_g, CFSTORE_UTEST_MSG_BUF_SIZE, "%s:Error: unable to generate kv_name.\n", __func__);
                TEST_ASSERT_MESSAGE(ret >= ARM_DRIVER_OK , cfstore_open_utest_msg_g);
                CFSTORE_TEST_UTEST_MESSAGE(cfstore_open_utest_msg_g, CFSTORE_UTEST_MSG_BUF_SIZE, "%s:Error: kv_name incorrect length (len=%d, expected= %d).\n", __func__, (int) strlen(kv_name), (int) name_len);
                TEST_ASSERT_MESSAGE(strlen(kv_name) == name_len, cfstore_open_utest_msg_g);

                /* overwrite a char at the pos start, mid, end of the kv_name with an ascii char code (both illegal and legal)*/
                switch(pos)
                {
                case cfstore_open_kv_name_pos_start:
                    kv_name[0] = (char) j;
                    break;
                case cfstore_open_kv_name_pos_mid:
                    /* create bad keyname strings with invalid character code in the middle of keyname */
                    kv_name[name_len/2] = (char) j;
                    break;
                case cfstore_open_kv_name_pos_end:
                    /* create bad keyname strings with invalid character code at end of keyname */
                    kv_name[name_len-1] = (char) j;
                    break;
                default:
                    CFSTORE_TEST_UTEST_MESSAGE(cfstore_open_utest_msg_g, CFSTORE_UTEST_MSG_BUF_SIZE, "%s:Error: unexpected value of pos (pos=%d).\n", __func__, (int) pos);
                    TEST_ASSERT_MESSAGE(ret >= ARM_DRIVER_OK, cfstore_open_utest_msg_g);
                    break;
                }

#ifdef CFSTORE_DEBUG
                /* processing only required when debug trace enabled */
                switch(pos)
                {
                case cfstore_open_kv_name_pos_start:
                    pos_str = "start";
                    break;
                case cfstore_open_kv_name_pos_mid:
                    pos_str = "middle";
                    break;
                case cfstore_open_kv_name_pos_end:
                    pos_str = "end";
                    break;
                default:
                    break;
                }
#endif
                ret = cfstore_test_create(kv_name, kv_name, &name_len, &kdesc);

                /* special cases */
                switch(j)
                {
                case 0 :
				case 46 :
                    switch(pos)
                    {
                    /* for code = 0 (null terminator). permitted at mid and end of string */
                    /* for code = 46 ('.'). permitted at mid and end of string but not at start */
                    case cfstore_open_kv_name_pos_start:
                        f_allowed = false;
                        break;
                    case cfstore_open_kv_name_pos_mid:
                    case cfstore_open_kv_name_pos_end:
                    default:
                        f_allowed = true;
                        break;
                    }
                    break;
				default:
					f_allowed = node->f_allowed;
					break;
                }
                if(f_allowed == true)
                {
                    CFSTORE_TEST_UTEST_MESSAGE(cfstore_open_utest_msg_g, CFSTORE_UTEST_MSG_BUF_SIZE, "%s:Error: failed to create KV in store when kv_name contains valid characters (code=%d, ret=%d).\n", __func__, (int) j, (int) ret);
                    TEST_ASSERT_MESSAGE(ret >= ARM_DRIVER_OK, cfstore_open_utest_msg_g);
                    /* revert CFSTORE_LOG for more trace */
                    CFSTORE_DBGLOG("Successfully created a KV with valid keyname containing ascii character code %d (%c) at the %s of the keyname.\n", (int) j, (int) j, pos_str);
                    CFSTORE_LOG("%c", '.');

                    ret = cfstore_test_delete(kv_name);
                    CFSTORE_TEST_UTEST_MESSAGE(cfstore_open_utest_msg_g, CFSTORE_UTEST_MSG_BUF_SIZE, "%s:Error: failed to delete KV previously created (code=%d, ret=%d).\n", __func__, (int) j, (int) ret);
                    TEST_ASSERT_MESSAGE(ret >= ARM_DRIVER_OK, cfstore_open_utest_msg_g);
                }
                else
                {   /*node->f_allowed == false => not allowed to create kv name with ascii code */
                    CFSTORE_TEST_UTEST_MESSAGE(cfstore_open_utest_msg_g, CFSTORE_UTEST_MSG_BUF_SIZE, "%s:Error: created KV in store when kv_name contains an invalid character (code=%d, ret=%d).\n", __func__, (int) j, (int) ret);
                    TEST_ASSERT_MESSAGE(ret < ARM_DRIVER_OK, cfstore_open_utest_msg_g);
                    /* revert CFSTORE_LOG for more trace */
                    CFSTORE_DBGLOG("Successfully failed to create a KV with an invalid keyname containing ascii character code %d at the %s of the keyname.\n", (int) j, pos_str);
                    CFSTORE_LOG("%c", '.');
                }
            }
        }
        node++;
    }

    CFSTORE_LOG("%c", '\n');
    CFSTORE_TEST_UTEST_MESSAGE(cfstore_open_utest_msg_g, CFSTORE_UTEST_MSG_BUF_SIZE, "%s:Error: Uninitialize() call failed.\n", __func__);
    TEST_ASSERT_MESSAGE(drv->Uninitialize() >= ARM_DRIVER_OK, cfstore_open_utest_msg_g);
    return CaseNext;
}

static const char cfstore_open_ascii_illegal_buf_g[] = "!\"�$%&'()*+,./:;<=>?@[\\]^_`{|}~"; /* 31 chars */

/** @brief  test to call cfstore_open() with key_name that in includes
 *          illegal characters
 *          - a max-length string of random illegal characters only
 *
 * @return on success returns CaseNext to continue to next test case, otherwise will assert on errors.
 */
control_t cfstore_open_test_06_end(const size_t call_count)
{
    char kv_name[CFSTORE_KEY_NAME_MAX_LENGTH+1];    /* extra char for terminating null */
    size_t i = 0;
    uint32_t pos = 0;
    int32_t ret = ARM_DRIVER_OK;
    size_t name_len = CFSTORE_KEY_NAME_MAX_LENGTH;
    ARM_CFSTORE_KEYDESC kdesc;
    size_t buf_data_max = 0;
    ARM_CFSTORE_DRIVER* drv = &cfstore_driver;

    CFSTORE_FENTRYLOG("%s:entered\n", __func__);
    (void) call_count;

    /* create bad keyname strings with invalid character code at start of keyname */
    buf_data_max = strlen(cfstore_open_ascii_illegal_buf_g);
    name_len = CFSTORE_KEY_NAME_MAX_LENGTH;
    memset(kv_name, 0, CFSTORE_KEY_NAME_MAX_LENGTH+1);
    kdesc.drl = ARM_RETENTION_WHILE_DEVICE_ACTIVE;

    /* generate a kv name of illegal chars*/
    for(i = 0; i < name_len; i++)
    {
        pos = rand() % (buf_data_max+1);
        kv_name[i] = cfstore_open_ascii_illegal_buf_g[pos];
    }

    ret = cfstore_test_create(kv_name, kv_name, &name_len, &kdesc);
    CFSTORE_TEST_UTEST_MESSAGE(cfstore_open_utest_msg_g, CFSTORE_UTEST_MSG_BUF_SIZE, "%s:Error: created KV in store when kv_name contains invalid characters (ret=%d).\n", __func__, (int) ret);
    TEST_ASSERT_MESSAGE(ret < ARM_DRIVER_OK, cfstore_open_utest_msg_g);

    CFSTORE_TEST_UTEST_MESSAGE(cfstore_open_utest_msg_g, CFSTORE_UTEST_MSG_BUF_SIZE, "%s:Error: Uninitialize() call failed.\n", __func__);
    TEST_ASSERT_MESSAGE(drv->Uninitialize() >= ARM_DRIVER_OK, cfstore_open_utest_msg_g);
    return CaseNext;
}

/** @brief  test to call cfstore_open() with key_name that in includes
 *          illegal characters
 *          - a max-length string of random characters (legal and illegal)
 *
 * @return on success returns CaseNext to continue to next test case, otherwise will assert on errors.
 */
control_t cfstore_open_test_07_end(const size_t call_count)
{
    char kv_name[CFSTORE_KEY_NAME_MAX_LENGTH+1];    /* extra char for terminating null */
    size_t i = 0;
    int32_t ret = ARM_DRIVER_OK;
    size_t name_len = CFSTORE_KEY_NAME_MAX_LENGTH;
    ARM_CFSTORE_KEYDESC kdesc;
    size_t buf_data_max = 0;
    ARM_CFSTORE_DRIVER* drv = &cfstore_driver;

    CFSTORE_FENTRYLOG("%s:entered\n", __func__);
    (void) call_count;

    /* create bad keyname strings with invalid character code at start of keyname */
    buf_data_max = strlen(cfstore_open_ascii_illegal_buf_g);
    name_len = CFSTORE_KEY_NAME_MAX_LENGTH;
    memset(kv_name, 0, CFSTORE_KEY_NAME_MAX_LENGTH+1);
    kdesc.drl = ARM_RETENTION_WHILE_DEVICE_ACTIVE;

    ret = cfstore_test_kv_name_gen(kv_name, name_len);
    CFSTORE_TEST_UTEST_MESSAGE(cfstore_open_utest_msg_g, CFSTORE_UTEST_MSG_BUF_SIZE, "%s:Error: unable to generate kv_name.\n", __func__);
    TEST_ASSERT_MESSAGE(ret >= ARM_DRIVER_OK , cfstore_open_utest_msg_g);

    /* pepper the illegal chars across the string*/
    for(i++; i < buf_data_max; i++){
        kv_name[rand() % (name_len+1)] = cfstore_open_ascii_illegal_buf_g[i];
    }
    ret = cfstore_test_create(kv_name, kv_name, &name_len, &kdesc);
    CFSTORE_TEST_UTEST_MESSAGE(cfstore_open_utest_msg_g, CFSTORE_UTEST_MSG_BUF_SIZE, "%s:Error: created KV in store when kv_name contains invalid characters (ret=%d).\n", __func__, (int) ret);
    TEST_ASSERT_MESSAGE(ret < ARM_DRIVER_OK, cfstore_open_utest_msg_g);

    CFSTORE_TEST_UTEST_MESSAGE(cfstore_open_utest_msg_g, CFSTORE_UTEST_MSG_BUF_SIZE, "%s:Error: Uninitialize() call failed.\n", __func__);
    TEST_ASSERT_MESSAGE(drv->Uninitialize() >= ARM_DRIVER_OK, cfstore_open_utest_msg_g);
    return CaseNext;
}

/// @cond CFSTORE_DOXYGEN_DISABLE
utest::v1::status_t greentea_setup(const size_t number_of_cases)
{
    GREENTEA_SETUP(CFSTORE_OPEN_GREENTEA_TIMEOUT_S, "default_auto");
    return greentea_test_setup_handler(number_of_cases);
}

Case cases[] = {
           /*          1         2         3         4         5         6        7  */
           /* 1234567890123456789012345678901234567890123456789012345678901234567890 */
        Case("OPEN_test_00", cfstore_open_test_00),
        Case("OPEN_test_01_start", cfstore_utest_default_start),
        Case("OPEN_test_01_end", cfstore_open_test_01_end),
        Case("OPEN_test_02_start", cfstore_utest_default_start),
        Case("OPEN_test_02_end", cfstore_open_test_02_end),
        Case("OPEN_test_03_start", cfstore_utest_default_start),
        Case("OPEN_test_03_end", cfstore_open_test_03_end),
        Case("OPEN_test_04_start", cfstore_utest_default_start),
        Case("OPEN_test_04_end", cfstore_open_test_04_end),
        Case("OPEN_test_05_start", cfstore_utest_default_start),
        Case("OPEN_test_05_end", cfstore_open_test_05_end),
        Case("OPEN_test_06_start", cfstore_utest_default_start),
        Case("OPEN_test_06_end", cfstore_open_test_06_end),
        Case("OPEN_test_07_start", cfstore_utest_default_start),
        Case("OPEN_test_07_end", cfstore_open_test_07_end),
};

/* Declare your test specification with a custom setup handler */
Specification specification(greentea_setup, cases);

int main()
{
    return !Harness::run(specification);
}
/// @endcond


text:
"use strict";

var Textbox = React.createClass({
  displayName: "Textbox",

  markup: function markup(text) {
    var md = new Remarkable();
    var html = md.render(text.toString());
    return { __html: html };
  },
  loadStringFromTextbox: function loadStringFromTextbox() {
    this.setState({ mdText: document.getElementById(this.props.source).value });
  },
  getInitialState: function getInitialState() {
    return { mdText: "" };
  },
  componentDidMount: function componentDidMount() {
    this.loadStringFromTextbox();
    setInterval(this.loadStringFromTextbox, this.props.interval);
  },
  render: function render() {
    return React.createElement("div", { className: "resultText", dangerouslySetInnerHTML: this.markup(this.state.mdText) });
  }
});

ReactDOM.render(React.createElement(Textbox, { source: "textarea", interval: 100 }), document.getElementById("result"));


text:
module Fog
  module Compute
    class AWS
      class Real

        require 'fog/aws/parsers/compute/basic'

        # Remove tags from resources
        #
        # ==== Parameters
        # * resources<~String> - One or more resources to remove tags from
        # * tags<~String> - hash of key value tag pairs to remove
        #
        # ==== Returns
        # * response<~Excon::Response>:
        #   * body<~Hash>:
        #     * 'requestId'<~String> - Id of request
        #     * 'return'<~Boolean> - success?
        #
        # {Amazon API Reference}[http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DeleteTags.html]
        def delete_tags(resources, tags)
          resources = [*resources]
          params = {}
          params.merge!(Fog::AWS.indexed_param('ResourceId', resources))

          # can not rely on indexed_param because nil values should be omitted
          tags.keys.each_with_index do |key, index|
            index += 1 # should start at 1 instead of 0
            params.merge!("Tag.#{index}.Key" => key)
            unless tags[key].nil?
              params.merge!("Tag.#{index}.Value" => tags[key])
            end
          end

          request({
            'Action'            => 'DeleteTags',
            :parser             => Fog::Parsers::Compute::AWS::Basic.new
          }.merge!(params))
        end

      end

      class Mock
        def delete_tags(resources, tags)
          tagged = Array(resources).map do |resource_id|
            type = case resource_id
            when /^ami\-[a-z0-9]{8}$/i
              'image'
            when /^i\-[a-z0-9]{8}$/i
              'instance'
            when /^snap\-[a-z0-9]{8}$/i
              'snapshot'
            when /^vol\-[a-z0-9]{8}$/i
              'volume'
            end
            if type && ((type == 'image' && visible_images[resource_id]) || self.data[:"#{type}s"][resource_id])
              { 'resourceId' => resource_id, 'resourceType' => type }
            else
              raise(Fog::Service::NotFound.new("The #{type} ID '#{resource_id}' does not exist"))
            end
          end

          tags.each do |key, value|
            self.data[:tags][key][value] = self.data[:tags][key][value] - tagged
          end

          tagged.each do |resource|
            tags.each do |key, value|
              tagset = self.data[:tag_sets][resource['resourceId']]
              tagset.delete(key) if tagset.has_key?(key) && (value.nil? || tagset[key] == value)
            end
          end

          response = Excon::Response.new
          response.status = true
          response.body = {
            'requestId' => Fog::AWS::Mock.request_id,
            'return'    => true
          }
          response
        end
      end

    end
  end
end


text:
using UnityEngine;

class RandomModule
{
    static public float Rand(float min = 0.0f, float max = 1.0f)
    {
        return Random.Range(min, max);
    }
}


text:
user 'mailcatcher user' do
  username node['mailcatcher']['user']
  comment 'MailCatcher User'
  home "#{node['mailcatcher']['dir']}/mailcatcher"
  shell '/bin/bash'
  manage_home true
  action :create
  system true
end

group 'mailcatcher group' do
  group_name node['mailcatcher']['group']
  action :create
  system true
end


text:
exports.definition = {
	config: {
		columns: {
		    "workItemId": "integer AUTOINCREMENT",
		    "title": "varchar",
		    "initiationDate": "datetime",
		    "isComplete": "boolean",
		    "customerId": "integer",
		    "bizId":"integer"
		},
		adapter: {
			type: "sql",
			collection_name: "workItems"
		}
	},
	extendModel: function(Model) {
		_.extend(Model.prototype, {
			// extended functions and properties go here
		});

		return Model;
	},
	extendCollection: function(Collection) {
		_.extend(Collection.prototype, {
			// extended functions and properties go here
		});

		return Collection;
	}
};


text:
using System;
using Gallio.Common.Reflection;
using Gallio.Framework.Pattern;

namespace Gallio.Framework.Pattern
{
    /// <summary>
    /// A test decorator pattern attribute applies decorations to a test defined by an
    /// assembly, type, or method.
    /// </summary>
    /// <seealso cref="TestTypePatternAttribute"/>
    [AttributeUsage(PatternAttributeTargets.Test, AllowMultiple = true, Inherited = true)]
    public abstract class TestDecoratorPatternAttribute : DecoratorPatternAttribute
    {
        /// <inheritdoc />
        public override void Process(IPatternScope scope, ICodeElementInfo codeElement)
        {
            //TODO: Review: Issue 762: Shouldn't the base method be invoked here?
            //base.Process(scope, codeElement);
            Validate(scope, codeElement);

            scope.TestBuilder.AddDeferredAction(codeElement, Order, delegate
            {
                DecorateTest(scope, codeElement);
            });
        }

        /// <summary>
        /// Verifies that the attribute is being used correctly.
        /// </summary>
        /// <param name="scope">The scope.</param>
        /// <param name="codeElement">The code element.</param>
        /// <exception cref="PatternUsageErrorException">Thrown if the attribute is being used incorrectly.</exception>
        protected virtual void Validate(IPatternScope scope, ICodeElementInfo codeElement)
        {
            if (!scope.IsTestDeclaration)
                ThrowUsageErrorException("This attribute can only be used on a test.");
        }

        /// <summary>
        /// Applies decorations to a test.
        /// </summary>
        /// <remarks>
        /// <para>
        /// A typical use of this method is to augment the test with additional metadata
        /// or to add additional behaviors to the test.
        /// </para>
        /// </remarks>
        /// <param name="scope">The scope.</param>
        /// <param name="codeElement">The code element.</param>
        protected virtual void DecorateTest(IPatternScope scope, ICodeElementInfo codeElement)
        {
        }
    }
}


text:
        <input type="text" placeholder="Add an item here." on-focus='toggleFocus()' on-focusout='toggleFocus()' (keyup.enter)='submitItem($event)'>

Hit enter to add

{{ item }}

            X