text:
package psidev.psi.mi.jami.xml.io.writer.elements.impl.extended.xml30;

import junit.framework.Assert;
import org.junit.Test;
import psidev.psi.mi.jami.exception.IllegalRangeException;
import psidev.psi.mi.jami.model.Feature;
import psidev.psi.mi.jami.model.FeatureEvidence;
import psidev.psi.mi.jami.model.ParameterValue;
import psidev.psi.mi.jami.model.Range;
import psidev.psi.mi.jami.model.impl.*;
import psidev.psi.mi.jami.utils.CvTermUtils;
import psidev.psi.mi.jami.utils.InteractorUtils;
import psidev.psi.mi.jami.utils.RangeUtils;
import psidev.psi.mi.jami.xml.cache.InMemoryIdentityObjectCache;
import psidev.psi.mi.jami.xml.cache.PsiXmlObjectCache;
import psidev.psi.mi.jami.xml.io.writer.elements.impl.AbstractXmlWriterTest;
import psidev.psi.mi.jami.xml.model.extension.XmlFeatureEvidence;

import javax.xml.stream.XMLStreamException;
import java.io.IOException;
import java.math.BigDecimal;

/**
 * Unit tester for XmlFeatureEvidenceWriter
 *
 * @author Marine Dumousseau (marine@ebi.ac.uk)
 * @version $Id$
 * @since
22/11/13

 */

public class XmlFeatureEvidenceWriterTest extends AbstractXmlWriterTest {

    private String feature = "<feature id=\"1\">\n" +
            "  <featureRangeList>\n" +
            "    <featureRange>\n" +
            "      <startStatus>\n" +
            "        <names>\n" +
            "          <shortLabel>certain</shortLabel>\n"+
            "        </names>\n"+
            "        <xref>\n" +
            "          <primaryRef db=\"psi-mi\" dbAc=\"MI:0488\" id=\"MI:0335\" refType=\"identity\" refTypeAc=\"MI:0356\"/>\n"+
            "        </xref>\n"+
            "      </startStatus>\n" +
            "      <begin position=\"1\"/>\n"+
            "      <endStatus>\n" +
            "        <names>\n" +
            "          <shortLabel>certain</shortLabel>\n"+
            "        </names>\n"+
            "        <xref>\n" +
            "          <primaryRef db=\"psi-mi\" dbAc=\"MI:0488\" id=\"MI:0335\" refType=\"identity\" refTypeAc=\"MI:0356\"/>\n"+
            "        </xref>\n"+
            "      </endStatus>\n" +
            "      <end position=\"4\"/>\n"+
            "    </featureRange>\n"+
            "  </featureRangeList>\n" +
            "</feature>";

    private String feature_shortName = "<feature id=\"1\">\n" +
            "  <names>\n" +
            "    <shortLabel>test feature</shortLabel>\n"+
            "  </names>\n"+
            "  <featureRangeList>\n" +
            "    <featureRange>\n" +
            "      <startStatus>\n" +
            "        <names>\n" +
            "          <shortLabel>certain</shortLabel>\n"+
            "        </names>\n"+
            "        <xref>\n" +
            "          <primaryRef db=\"psi-mi\" dbAc=\"MI:0488\" id=\"MI:0335\" refType=\"identity\" refTypeAc=\"MI:0356\"/>\n"+
            "        </xref>\n"+
            "      </startStatus>\n" +
            "      <begin position=\"1\"/>\n"+
            "      <endStatus>\n" +
            "        <names>\n" +
            "          <shortLabel>certain</shortLabel>\n"+
            "        </names>\n"+
            "        <xref>\n" +
            "          <primaryRef db=\"psi-mi\" dbAc=\"MI:0488\" id=\"MI:0335\" refType=\"identity\" refTypeAc=\"MI:0356\"/>\n"+
            "        </xref>\n"+
            "      </endStatus>\n" +
            "      <end position=\"4\"/>\n"+
            "    </featureRange>\n"+
            "  </featureRangeList>\n" +
            "</feature>";

    private String feature_fullName = "<feature id=\"1\">\n" +
            "  <names>\n" +
            "    <fullName>test feature</fullName>\n"+
            "  </names>\n"+
            "  <featureRangeList>\n" +
            "    <featureRange>\n" +
            "      <startStatus>\n" +
            "        <names>\n" +
            "          <shortLabel>certain</shortLabel>\n"+
            "        </names>\n"+
            "        <xref>\n" +
            "          <primaryRef db=\"psi-mi\" dbAc=\"MI:0488\" id=\"MI:0335\" refType=\"identity\" refTypeAc=\"MI:0356\"/>\n"+
            "        </xref>\n"+
            "      </startStatus>\n" +
            "      <begin position=\"1\"/>\n"+
            "      <endStatus>\n" +
            "        <names>\n" +
            "          <shortLabel>certain</shortLabel>\n"+
            "        </names>\n"+
            "        <xref>\n" +
            "          <primaryRef db=\"psi-mi\" dbAc=\"MI:0488\" id=\"MI:0335\" refType=\"identity\" refTypeAc=\"MI:0356\"/>\n"+
            "        </xref>\n"+
            "      </endStatus>\n" +
            "      <end position=\"4\"/>\n"+
            "    </featureRange>\n"+
            "  </featureRangeList>\n" +
            "</feature>";

    private String feature_aliases = "<feature id=\"1\">\n" +
            "  <names>\n" +
            "    <alias type=\"synonym\">feature synonym</alias>\n"+
            "    <alias>test</alias>\n"+
            "  </names>\n"+
            "  <featureRangeList>\n" +
            "    <featureRange>\n" +
            "      <startStatus>\n" +
            "        <names>\n" +
            "          <shortLabel>certain</shortLabel>\n"+
            "        </names>\n"+
            "        <xref>\n" +
            "          <primaryRef db=\"psi-mi\" dbAc=\"MI:0488\" id=\"MI:0335\" refType=\"identity\" refTypeAc=\"MI:0356\"/>\n"+
            "        </xref>\n"+
            "      </startStatus>\n" +
            "      <begin position=\"1\"/>\n"+
            "      <endStatus>\n" +
            "        <names>\n" +
            "          <shortLabel>certain</shortLabel>\n"+
            "        </names>\n"+
            "        <xref>\n" +
            "          <primaryRef db=\"psi-mi\" dbAc=\"MI:0488\" id=\"MI:0335\" refType=\"identity\" refTypeAc=\"MI:0356\"/>\n"+
            "        </xref>\n"+
            "      </endStatus>\n" +
            "      <end position=\"4\"/>\n"+
            "    </featureRange>\n"+
            "  </featureRangeList>\n" +
            "</feature>";

    private String featureIdentifier = "<feature id=\"1\">\n" +
            "  <xref>\n" +
            "    <primaryRef db=\"interpro\" dbAc=\"MI:0449\" id=\"IPRxxxxx\" refType=\"identity\" refTypeAc=\"MI:0356\"/>\n" +
            "    <secondaryRef db=\"test\" id=\"xxxx1\"/>\n"+
            "  </xref>\n"+
            "  <featureRangeList>\n" +
            "    <featureRange>\n" +
            "      <startStatus>\n" +
            "        <names>\n" +
            "          <shortLabel>certain</shortLabel>\n"+
            "        </names>\n"+
            "        <xref>\n" +
            "          <primaryRef db=\"psi-mi\" dbAc=\"MI:0488\" id=\"MI:0335\" refType=\"identity\" refTypeAc=\"MI:0356\"/>\n"+
            "        </xref>\n"+
            "      </startStatus>\n" +
            "      <begin position=\"1\"/>\n"+
            "      <endStatus>\n" +
            "        <names>\n" +
            "          <shortLabel>certain</shortLabel>\n"+
            "        </names>\n"+
            "        <xref>\n" +
            "          <primaryRef db=\"psi-mi\" dbAc=\"MI:0488\" id=\"MI:0335\" refType=\"identity\" refTypeAc=\"MI:0356\"/>\n"+
            "        </xref>\n"+
            "      </endStatus>\n" +
            "      <end position=\"4\"/>\n"+
            "    </featureRange>\n"+
            "  </featureRangeList>\n" +
            "</feature>";
    private String featureXref = "<feature id=\"1\">\n" +
            "  <xref>\n" +
            "    <primaryRef db=\"test\" id=\"xxxx12\" refType=\"see-also\"/>\n" +
            "    <secondaryRef db=\"test\" id=\"xxxx1\"/>\n"+
            "  </xref>\n"+
            "  <featureRangeList>\n" +
            "    <featureRange>\n" +
            "      <startStatus>\n" +
            "        <names>\n" +
            "          <shortLabel>certain</shortLabel>\n"+
            "        </names>\n"+
            "        <xref>\n" +
            "          <primaryRef db=\"psi-mi\" dbAc=\"MI:0488\" id=\"MI:0335\" refType=\"identity\" refTypeAc=\"MI:0356\"/>\n"+
            "        </xref>\n"+
            "      </startStatus>\n" +
            "      <begin position=\"1\"/>\n"+
            "      <endStatus>\n" +
            "        <names>\n" +
            "          <shortLabel>certain</shortLabel>\n"+
            "        </names>\n"+
            "        <xref>\n" +
            "          <primaryRef db=\"psi-mi\" dbAc=\"MI:0488\" id=\"MI:0335\" refType=\"identity\" refTypeAc=\"MI:0356\"/>\n"+
            "        </xref>\n"+
            "      </endStatus>\n" +
            "      <end position=\"4\"/>\n"+
            "    </featureRange>\n"+
            "  </featureRangeList>\n" +
            "</feature>";
    private String feature_featureType = "<feature id=\"1\">\n" +
            "  <featureType>\n" +
            "    <names>\n" +
            "      <shortLabel>biological feature</shortLabel>\n" +
            "    </names>\n" +
            "    <xref>\n" +
            "      <primaryRef db=\"psi-mi\" dbAc=\"MI:0488\" id=\"MI:xxx1\" refType=\"identity\" refTypeAc=\"MI:0356\"/>\n" +
            "    </xref>\n" +
            "  </featureType>\n" +
            "  <featureRangeList>\n" +
            "    <featureRange>\n" +
            "      <startStatus>\n" +
            "        <names>\n" +
            "          <shortLabel>certain</shortLabel>\n"+
            "        </names>\n"+
            "        <xref>\n" +
            "          <primaryRef db=\"psi-mi\" dbAc=\"MI:0488\" id=\"MI:0335\" refType=\"identity\" refTypeAc=\"MI:0356\"/>\n"+
            "        </xref>\n"+
            "      </startStatus>\n" +
            "      <begin position=\"1\"/>\n"+
            "      <endStatus>\n" +
            "        <names>\n" +
            "          <shortLabel>certain</shortLabel>\n"+
            "        </names>\n"+
            "        <xref>\n" +
            "          <primaryRef db=\"psi-mi\" dbAc=\"MI:0488\" id=\"MI:0335\" refType=\"identity\" refTypeAc=\"MI:0356\"/>\n"+
            "        </xref>\n"+
            "      </endStatus>\n" +
            "      <end position=\"4\"/>\n"+
            "    </featureRange>\n"+
            "  </featureRangeList>\n" +
            "</feature>";
    private String featureAttributes = "<feature id=\"1\">\n" +
            "  <featureRangeList>\n" +
            "    <featureRange>\n" +
            "      <startStatus>\n" +
            "        <names>\n" +
            "          <shortLabel>certain</shortLabel>\n"+
            "        </names>\n"+
            "        <xref>\n" +
            "          <primaryRef db=\"psi-mi\" dbAc=\"MI:0488\" id=\"MI:0335\" refType=\"identity\" refTypeAc=\"MI:0356\"/>\n"+
            "        </xref>\n"+
            "      </startStatus>\n" +
            "      <begin position=\"1\"/>\n"+
            "      <endStatus>\n" +
            "        <names>\n" +
            "          <shortLabel>certain</shortLabel>\n"+
            "        </names>\n"+
            "        <xref>\n" +
            "          <primaryRef db=\"psi-mi\" dbAc=\"MI:0488\" id=\"MI:0335\" refType=\"identity\" refTypeAc=\"MI:0356\"/>\n"+
            "        </xref>\n"+
            "      </endStatus>\n" +
            "      <end position=\"4\"/>\n"+
            "    </featureRange>\n"+
            "  </featureRangeList>\n" +
            "  <attributeList>\n" +
            "    <attribute name=\"test2\"/>\n"+
            "    <attribute name=\"test3\"/>\n"+
            "  </attributeList>\n"+
            "</feature>";

    private String feature_interactionEffect = "<feature id=\"1\">\n" +
            "  <featureRangeList>\n" +
            "    <featureRange>\n" +
            "      <startStatus>\n" +
            "        <names>\n" +
            "          <shortLabel>certain</shortLabel>\n"+
            "        </names>\n"+
            "        <xref>\n" +
            "          <primaryRef db=\"psi-mi\" dbAc=\"MI:0488\" id=\"MI:0335\" refType=\"identity\" refTypeAc=\"MI:0356\"/>\n"+
            "        </xref>\n"+
            "      </startStatus>\n" +
            "      <begin position=\"1\"/>\n"+
            "      <endStatus>\n" +
            "        <names>\n" +
            "          <shortLabel>certain</shortLabel>\n"+
            "        </names>\n"+
            "        <xref>\n" +
            "          <primaryRef db=\"psi-mi\" dbAc=\"MI:0488\" id=\"MI:0335\" refType=\"identity\" refTypeAc=\"MI:0356\"/>\n"+
            "        </xref>\n"+
            "      </endStatus>\n" +
            "      <end position=\"4\"/>\n"+
            "    </featureRange>\n"+
            "  </featureRangeList>\n" +
            "  <featureRole>\n" +
            "    <names>\n" +
            "      <shortLabel>decreasing-ptm</shortLabel>\n" +
            "    </names>\n" +
            "    <xref>\n" +
            "      <primaryRef db=\"psi-mi\" dbAc=\"MI:0488\" id=\"MI:1223\" refType=\"identity\" refTypeAc=\"MI:0356\"/>\n" +
            "    </xref>\n" +
            "  </featureRole>\n"+
            "</feature>";

    private String feature_interactionDependency = "<feature id=\"1\">\n" +
            "  <featureRangeList>\n" +
            "    <featureRange>\n" +
            "      <startStatus>\n" +
            "        <names>\n" +
            "          <shortLabel>certain</shortLabel>\n"+
            "        </names>\n"+
            "        <xref>\n" +
            "          <primaryRef db=\"psi-mi\" dbAc=\"MI:0488\" id=\"MI:0335\" refType=\"identity\" refTypeAc=\"MI:0356\"/>\n"+
            "        </xref>\n"+
            "      </startStatus>\n" +
            "      <begin position=\"1\"/>\n"+
            "      <endStatus>\n" +
            "        <names>\n" +
            "          <shortLabel>certain</shortLabel>\n"+
            "        </names>\n"+
            "        <xref>\n" +
            "          <primaryRef db=\"psi-mi\" dbAc=\"MI:0488\" id=\"MI:0335\" refType=\"identity\" refTypeAc=\"MI:0356\"/>\n"+
            "        </xref>\n"+
            "      </endStatus>\n" +
            "      <end position=\"4\"/>\n"+
            "    </featureRange>\n"+
            "  </featureRangeList>\n" +
            "  <featureRole>\n" +
            "    <names>\n" +
            "      <shortLabel>resulting-ptm</shortLabel>\n" +
            "    </names>\n" +
            "    <xref>\n" +
            "      <primaryRef db=\"psi-mi\" dbAc=\"MI:0488\" id=\"MI:0639\" refType=\"identity\" refTypeAc=\"MI:0356\"/>\n" +
            "    </xref>\n" +
            "  </featureRole>\n"+
            "</feature>";

    private String feature_participantRef = "<feature id=\"1\">\n" +
            "  <featureRangeList>\n" +
            "    <featureRange>\n" +
            "      <startStatus>\n" +
            "        <names>\n" +
            "          <shortLabel>certain</shortLabel>\n"+
            "        </names>\n"+
            "        <xref>\n" +
            "          <primaryRef db=\"psi-mi\" dbAc=\"MI:0488\" id=\"MI:0335\" refType=\"identity\" refTypeAc=\"MI:0356\"/>\n"+
            "        </xref>\n"+
            "      </startStatus>\n" +
            "      <begin position=\"1\"/>\n"+
            "      <endStatus>\n" +
            "        <names>\n" +
            "          <shortLabel>certain</shortLabel>\n"+
            "        </names>\n"+
            "        <xref>\n" +
            "          <primaryRef db=\"psi-mi\" dbAc=\"MI:0488\" id=\"MI:0335\" refType=\"identity\" refTypeAc=\"MI:0356\"/>\n"+
            "        </xref>\n"+
            "      </endStatus>\n" +
            "      <end position=\"4\"/>\n"+
            "      <participantRef>2</participantRef>\n"+
            "    </featureRange>\n" +
            "  </featureRangeList>\n" +
            "</feature>";

    private String feature_registered = "<feature id=\"2\">\n" +
            "  <featureRangeList>\n" +
            "    <featureRange>\n" +
            "      <startStatus>\n" +
            "        <names>\n" +
            "          <shortLabel>certain</shortLabel>\n"+
            "        </names>\n"+
            "        <xref>\n" +
            "          <primaryRef db=\"psi-mi\" dbAc=\"MI:0488\" id=\"MI:0335\" refType=\"identity\" refTypeAc=\"MI:0356\"/>\n"+
            "        </xref>\n"+
            "      </startStatus>\n" +
            "      <begin position=\"1\"/>\n"+
            "      <endStatus>\n" +
            "        <names>\n" +
            "          <shortLabel>certain</shortLabel>\n"+
            "        </names>\n"+
            "        <xref>\n" +
            "          <primaryRef db=\"psi-mi\" dbAc=\"MI:0488\" id=\"MI:0335\" refType=\"identity\" refTypeAc=\"MI:0356\"/>\n"+
            "        </xref>\n"+
            "      </endStatus>\n" +
            "      <end position=\"4\"/>\n"+
            "    </featureRange>\n"+
            "  </featureRangeList>\n" +
            "</feature>";

    private String feature_detectionMethod = "<feature id=\"1\">\n" +
            "  <featureDetectionMethod>\n" +
            "    <names>\n" +
            "      <shortLabel>inferred</shortLabel>\n"+
            "    </names>\n"+
            "    <xref>\n" +
            "      <primaryRef db=\"psi-mi\" dbAc=\"MI:0488\" id=\"MI:0362\" refType=\"identity\" refTypeAc=\"MI:0356\"/>\n"+
            "    </xref>\n"+
            "  </featureDetectionMethod>\n"+
            "  <featureDetectionMethod>\n" +
            "    <names>\n" +
            "      <shortLabel>autoradiography</shortLabel>\n"+
            "    </names>\n"+
            "    <xref>\n" +
            "      <primaryRef db=\"psi-mi\" dbAc=\"MI:0488\" id=\"MI:0833\" refType=\"identity\" refTypeAc=\"MI:0356\"/>\n"+
            "    </xref>\n"+
            "  </featureDetectionMethod>\n"+
            "  <featureRangeList>\n" +
            "    <featureRange>\n" +
            "      <startStatus>\n" +
            "        <names>\n" +
            "          <shortLabel>certain</shortLabel>\n"+
            "        </names>\n"+
            "        <xref>\n" +
            "          <primaryRef db=\"psi-mi\" dbAc=\"MI:0488\" id=\"MI:0335\" refType=\"identity\" refTypeAc=\"MI:0356\"/>\n"+
            "        </xref>\n"+
            "      </startStatus>\n" +
            "      <begin position=\"1\"/>\n"+
            "      <endStatus>\n" +
            "        <names>\n" +
            "          <shortLabel>certain</shortLabel>\n"+
            "        </names>\n"+
            "        <xref>\n" +
            "          <primaryRef db=\"psi-mi\" dbAc=\"MI:0488\" id=\"MI:0335\" refType=\"identity\" refTypeAc=\"MI:0356\"/>\n"+
            "        </xref>\n"+
            "      </endStatus>\n" +
            "      <end position=\"4\"/>\n"+
            "    </featureRange>\n"+
            "  </featureRangeList>\n" +
            "</feature>";
    private String feature_experiments = "<feature id=\"1\">\n" +
            "  <experimentRefList>\n" +
            "    <experimentRef>2</experimentRef>\n" +
            "  </experimentRefList>\n" +
            "  <featureRangeList>\n" +
            "    <featureRange>\n" +
            "      <startStatus>\n" +
            "        <names>\n" +
            "          <shortLabel>certain</shortLabel>\n"+
            "        </names>\n"+
            "        <xref>\n" +
            "          <primaryRef db=\"psi-mi\" dbAc=\"MI:0488\" id=\"MI:0335\" refType=\"identity\" refTypeAc=\"MI:0356\"/>\n"+
            "        </xref>\n"+
            "      </startStatus>\n" +
            "      <begin position=\"1\"/>\n"+
            "      <endStatus>\n" +
            "        <names>\n" +
            "          <shortLabel>certain</shortLabel>\n"+
            "        </names>\n"+
            "        <xref>\n" +
            "          <primaryRef db=\"psi-mi\" dbAc=\"MI:0488\" id=\"MI:0335\" refType=\"identity\" refTypeAc=\"MI:0356\"/>\n"+
            "        </xref>\n"+
            "      </endStatus>\n" +
            "      <end position=\"4\"/>\n"+
            "    </featureRange>\n"+
            "  </featureRangeList>\n" +
            "</feature>";
    private String feature_experiments_registed = "<feature id=\"3\">\n" +
            "  <experimentRefList>\n" +
            "    <experimentRef>2</experimentRef>\n" +
            "  </experimentRefList>\n" +
            "  <featureRangeList>\n" +
            "    <featureRange>\n" +
            "      <startStatus>\n" +
            "        <names>\n" +
            "          <shortLabel>certain</shortLabel>\n"+
            "        </names>\n"+
            "        <xref>\n" +
            "          <primaryRef db=\"psi-mi\" dbAc=\"MI:0488\" id=\"MI:0335\" refType=\"identity\" refTypeAc=\"MI:0356\"/>\n"+
            "        </xref>\n"+
            "      </startStatus>\n" +
            "      <begin position=\"1\"/>\n"+
            "      <endStatus>\n" +
            "        <names>\n" +
            "          <shortLabel>certain</shortLabel>\n"+
            "        </names>\n"+
            "        <xref>\n" +
            "          <primaryRef db=\"psi-mi\" dbAc=\"MI:0488\" id=\"MI:0335\" refType=\"identity\" refTypeAc=\"MI:0356\"/>\n"+
            "        </xref>\n"+
            "      </endStatus>\n" +
            "      <end position=\"4\"/>\n"+
            "    </featureRange>\n"+
            "  </featureRangeList>\n" +
            "</feature>";
    private String feature_parameters = "<feature id=\"1\">\n" +
            "  <featureRangeList>\n" +
            "    <featureRange>\n" +
            "      <startStatus>\n" +
            "        <names>\n" +
            "          <shortLabel>certain</shortLabel>\n"+
            "        </names>\n"+
            "        <xref>\n" +
            "          <primaryRef db=\"psi-mi\" dbAc=\"MI:0488\" id=\"MI:0335\" refType=\"identity\" refTypeAc=\"MI:0356\"/>\n"+
            "        </xref>\n"+
            "      </startStatus>\n" +
            "      <begin position=\"1\"/>\n"+
            "      <endStatus>\n" +
            "        <names>\n" +
            "          <shortLabel>certain</shortLabel>\n"+
            "        </names>\n"+
            "        <xref>\n" +
            "          <primaryRef db=\"psi-mi\" dbAc=\"MI:0488\" id=\"MI:0335\" refType=\"identity\" refTypeAc=\"MI:0356\"/>\n"+
            "        </xref>\n"+
            "      </endStatus>\n" +
            "      <end position=\"4\"/>\n"+
            "    </featureRange>\n"+
            "  </featureRangeList>\n" +
            "  <parameterList>\n" +
            "    <parameter term=\"kd\" base=\"10\" exponent=\"0\" factor=\"5\"/>\n" +
            "  </parameterList>\n" +
            "</feature>";

    private PsiXmlObjectCache elementCache = new InMemoryIdentityObjectCache();

    @Test
    public void test_write_feature() throws XMLStreamException, IOException, IllegalRangeException {
        FeatureEvidence feature = new XmlFeatureEvidence();
        feature.getRanges().add(RangeUtils.createRangeFromString("1-4"));
        elementCache.clear();

        XmlFeatureEvidenceWriter writer = new XmlFeatureEvidenceWriter(createStreamWriter(), this.elementCache);
        writer.write(feature);
        streamWriter.flush();

        Assert.assertEquals(this.feature, output.toString());
    }

    @Test
    public void test_write_feature_shortName() throws XMLStreamException, IOException, IllegalRangeException {
        FeatureEvidence feature = new XmlFeatureEvidence();
        feature.getRanges().add(RangeUtils.createRangeFromString("1-4"));
        feature.setShortName("test feature");
        elementCache.clear();

        XmlFeatureEvidenceWriter writer = new XmlFeatureEvidenceWriter(createStreamWriter(), this.elementCache);
        writer.write(feature);
        streamWriter.flush();

        Assert.assertEquals(this.feature_shortName, output.toString());
    }

    @Test
    public void test_write_feature_fullName() throws XMLStreamException, IOException, IllegalRangeException {
        FeatureEvidence feature = new XmlFeatureEvidence();
        feature.getRanges().add(RangeUtils.createRangeFromString("1-4"));
        feature.setFullName("test feature");

        elementCache.clear();

        XmlFeatureEvidenceWriter writer = new XmlFeatureEvidenceWriter(createStreamWriter(), this.elementCache);
        writer.write(feature);
        streamWriter.flush();

        Assert.assertEquals(this.feature_fullName, output.toString());
    }

    @Test
    public void test_write_feature_alias() throws XMLStreamException, IOException, IllegalRangeException {
        Feature feature = new XmlFeatureEvidence();
        feature.getRanges().add(RangeUtils.createRangeFromString("1-4"));
        feature.getAliases().add(new DefaultAlias(new DefaultCvTerm("synonym"), "feature synonym"));
        feature.getAliases().add(new DefaultAlias("test"));

        elementCache.clear();

        XmlFeatureEvidenceWriter writer = new XmlFeatureEvidenceWriter(createStreamWriter(), this.elementCache);
        writer.write((FeatureEvidence)feature);
        streamWriter.flush();

        Assert.assertEquals(this.feature_aliases, output.toString());
    }

    @Test
    public void test_write_feature_identifier() throws XMLStreamException, IOException, IllegalRangeException {
        FeatureEvidence feature = new XmlFeatureEvidence();
        feature.getRanges().add(RangeUtils.createRangeFromString("1-4"));
        feature.getXrefs().add(new DefaultXref(new DefaultCvTerm("test"), "xxxx1"));
        feature.setInterpro("IPRxxxxx");

        elementCache.clear();

        XmlFeatureEvidenceWriter writer = new XmlFeatureEvidenceWriter(createStreamWriter(), this.elementCache);
        writer.write(feature);
        streamWriter.flush();

        Assert.assertEquals(this.featureIdentifier, output.toString());
    }

    @Test
    public void test_write_feature_xref() throws XMLStreamException, IOException, IllegalRangeException {
        FeatureEvidence feature = new XmlFeatureEvidence();
        feature.getRanges().add(RangeUtils.createRangeFromString("1-4"));
        feature.getXrefs().add(new DefaultXref(new DefaultCvTerm("test"), "xxxx12", new DefaultCvTerm("see-also")));
        feature.getXrefs().add(new DefaultXref(new DefaultCvTerm("test"), "xxxx1"));

        elementCache.clear();

        XmlFeatureEvidenceWriter writer = new XmlFeatureEvidenceWriter(createStreamWriter(), this.elementCache);
        writer.write(feature);
        streamWriter.flush();

        Assert.assertEquals(this.featureXref, output.toString());
    }

    @Test
    public void test_write_feature_featureType() throws XMLStreamException, IOException, IllegalRangeException {
        FeatureEvidence feature = new XmlFeatureEvidence();
        feature.getRanges().add(RangeUtils.createRangeFromString("1-4"));
        feature.setType(new DefaultCvTerm("biological feature", "MI:xxx1"));

        elementCache.clear();

        XmlFeatureEvidenceWriter writer = new XmlFeatureEvidenceWriter(createStreamWriter(), this.elementCache);
        writer.write(feature);
        streamWriter.flush();

        Assert.assertEquals(this.feature_featureType, output.toString());
    }

    @Test
    public void test_write_feature_attribute() throws XMLStreamException, IOException, IllegalRangeException {
        FeatureEvidence feature = new XmlFeatureEvidence();
        feature.getRanges().add(RangeUtils.createRangeFromString("1-4"));
        feature.getAnnotations().add(new DefaultAnnotation(new DefaultCvTerm("test2")));
        feature.getAnnotations().add(new DefaultAnnotation(new DefaultCvTerm("test3")));

        elementCache.clear();

        XmlFeatureEvidenceWriter writer = new XmlFeatureEvidenceWriter(createStreamWriter(), this.elementCache);
        writer.write(feature);
        streamWriter.flush();

        Assert.assertEquals(this.featureAttributes, output.toString());
    }

    @Test
    public void test_write_feature_interaction_effect() throws XMLStreamException, IOException, IllegalRangeException {
        FeatureEvidence feature = new XmlFeatureEvidence();
        feature.getRanges().add(RangeUtils.createRangeFromString("1-4"));
        feature.setRole(CvTermUtils.createMICvTerm("decreasing-ptm", "MI:1223"));
        elementCache.clear();

        XmlFeatureEvidenceWriter writer = new XmlFeatureEvidenceWriter(createStreamWriter(), this.elementCache);
        writer.write(feature);
        streamWriter.flush();

        Assert.assertEquals(this.feature_interactionEffect, output.toString());
    }

    @Test
    public void test_write_feature_interaction_dependency() throws XMLStreamException, IOException, IllegalRangeException {
        FeatureEvidence feature = new XmlFeatureEvidence();
        feature.getRanges().add(RangeUtils.createRangeFromString("1-4"));
        feature.setRole(CvTermUtils.createMICvTerm("resulting-ptm", "MI:0639"));

        elementCache.clear();

        XmlFeatureEvidenceWriter writer = new XmlFeatureEvidenceWriter(createStreamWriter(), this.elementCache);
        writer.write(feature);
        streamWriter.flush();

        Assert.assertEquals(this.feature_interactionDependency, output.toString());
    }

    @Test
    public void test_write_feature_participant_ref() throws XMLStreamException, IOException, IllegalRangeException {
        FeatureEvidence feature = new XmlFeatureEvidence();
        Range range = RangeUtils.createRangeFromString("1-4");
        feature.getRanges().add(range);
        range.setParticipant(new DefaultParticipant(InteractorUtils.createUnknownBasicInteractor()));
        elementCache.clear();

        XmlFeatureEvidenceWriter writer = new XmlFeatureEvidenceWriter(createStreamWriter(), this.elementCache);
        writer.write(feature);
        streamWriter.flush();

        Assert.assertEquals(this.feature_participantRef, output.toString());
    }

    @Test
    public void test_write_feature_registered() throws XMLStreamException, IOException, IllegalRangeException {
        FeatureEvidence feature = new XmlFeatureEvidence();
        feature.getRanges().add(RangeUtils.createRangeFromString("1-4"));

        elementCache.clear();
        elementCache.extractIdForFeature(new DefaultFeature());
        elementCache.extractIdForFeature(feature);

        XmlFeatureEvidenceWriter writer = new XmlFeatureEvidenceWriter(createStreamWriter(), this.elementCache);
        writer.write(feature);
        streamWriter.flush();

        Assert.assertEquals(this.feature_registered, output.toString());
    }

    @Test
    public void test_write_feature_detectionMethod() throws XMLStreamException, IOException, IllegalRangeException {
        FeatureEvidence feature = new XmlFeatureEvidence();
        feature.getRanges().add(RangeUtils.createRangeFromString("1-4"));
        feature.getDetectionMethods().add(new DefaultCvTerm("inferred", "MI:0362"));
        feature.getDetectionMethods().add(new DefaultCvTerm("autoradiography","MI:0833"));

        elementCache.clear();

        XmlFeatureEvidenceWriter writer = new XmlFeatureEvidenceWriter(createStreamWriter(), this.elementCache);
        writer.write(feature);
        streamWriter.flush();

        Assert.assertEquals(this.feature_detectionMethod, output.toString());
    }

    @Test
    public void test_write_feature_experiments() throws XMLStreamException, IOException, IllegalRangeException {
        XmlFeatureEvidence feature = new XmlFeatureEvidence();
        feature.getRanges().add(RangeUtils.createRangeFromString("1-4"));
        feature.getExperiments().add(new DefaultExperiment(new DefaultPublication()));
        elementCache.clear();

        XmlFeatureEvidenceWriter writer = new XmlFeatureEvidenceWriter(createStreamWriter(), this.elementCache);
        writer.write(feature);
        streamWriter.flush();

        Assert.assertEquals(this.feature_experiments, output.toString());
    }

    @Test
    public void test_write_feature_experiments_registered() throws XMLStreamException, IOException, IllegalRangeException {
        XmlFeatureEvidence feature = new XmlFeatureEvidence();
        feature.getRanges().add(RangeUtils.createRangeFromString("1-4"));
        feature.getExperiments().add(new DefaultExperiment(new DefaultPublication()));
        elementCache.clear();
        elementCache.extractIdForExperiment(new DefaultExperiment(new DefaultPublication("12345")));
        elementCache.extractIdForExperiment(feature.getExperiments().iterator().next());

        XmlFeatureEvidenceWriter writer = new XmlFeatureEvidenceWriter(createStreamWriter(), this.elementCache);
        writer.write(feature);
        streamWriter.flush();

        Assert.assertEquals(this.feature_experiments_registed, output.toString());
    }

    @Test
    public void test_write_feature_parameters() throws XMLStreamException, IOException, IllegalRangeException {
        FeatureEvidence feature = new XmlFeatureEvidence();
        feature.getRanges().add(RangeUtils.createRangeFromString("1-4"));
        feature.getParameters().add(new DefaultModelledParameter(new DefaultCvTerm("kd"), new ParameterValue(new BigDecimal(5))));
        elementCache.clear();

        XmlFeatureEvidenceWriter writer = new XmlFeatureEvidenceWriter(createStreamWriter(), this.elementCache);
        writer.write(feature);
        streamWriter.flush();

        Assert.assertEquals(this.feature_parameters, output.toString());
    }
}


text:
<?php

namespace Shukay\DropzoneBundle;

use Symfony\Component\HttpKernel\Bundle\Bundle;

class ShukayDropzoneBundle extends Bundle
{
}

redpajama_set_name: RedPajamaGithub


text:
<?php //-->

namespace Eden\GitHub\Repository;

use Eden\GitHub\Argument;
use Eden\Type\StringType;

/**
 * GitHub API - Repository: Status
 *
 * @vendor Eden
 * @package GitHub\Repository
 * @author Ian Mark Muninio <ianmuninio@openovate.com>
 */
class Status extends Base
{
    protected $link = array(
        'STATUS' => 'repos/:owner/:repo/statuses/:data'
    );

    /**
     * Lists the contributors.
     *
     * @param string $owner
     * @param string $repo
     * @param string $ref   ref to list the statuses from. It can be a SHA, a branch name, or a tag name.
     * @return array
     */
    public function getStatuses($owner, $repo, $ref)
    {
        Argument::i()
                ->test(1, 'string')
                ->test(2, 'string')
                ->test(3, 'string');

        $post = array(
            'ref' => $ref
        );

        // search and replace
        $link = StringType::i($this->link['STATUS'])
                ->str_replace(':owner', $owner)
                ->str_replace(':repo', $repo)
                ->str_replace(':data', $ref)
                ->get();

        return $this->getResponse($link, $post);
    }

    /**
     * Creates a status. Users with push access can create commit statuses for a given ref.
     *
     * @param string      $owner
     * @param string      $repo
     * @param string      $sha
     * @param string      $state
     * @param string|null $targetUrl
     * @param string|null $description
     * @return array
     */
    public function createStatus(
            $owner,
            $repo,
            $sha,
            $state,
            $targetUrl = null,
            $description = null
    ) {
        Argument::i()
                ->test(1, 'string')
                ->test(2, 'string')
                ->test(3, 'string')
                ->test(4, 'string')
                ->test(5, 'string', 'null')
                ->test(6, 'string', 'null');

        $post = array(
            'state' => $state
        );

        // check and set
        if ($targetUrl) {
            $post['target_url'] = $targetUrl;
        }

        if ($description) {
            $post['description'] = $description;
        }

        // search and replace
        $link = StringType::i($this->link['STATUS'])
                ->str_replace(':owner', $owner)
                ->str_replace(':repo', $repo)
                ->str_replace(':data', $sha)
                ->get();

        return $this->postResponse($link, $post);
    }
}


text:
<input type="checkbox" class="sidebar-checkbox" id="sidebar-checkbox" checked>

{{ site.description }}

    {% comment %}
      The code below dynamically generates a sidebar nav of pages with
      `layout: page` in the front-matter. See readme for usage.
    {% endcomment %}

    {% assign pages_list = site.pages %}
    {% for node in pages_list %}
      {% if node.title != null %}
        {% if node.layout == "page" %}
          {{ node.title }}
        {% endif %}
      {% endif %}
    {% endfor %}

    Softwares
    Resume
        GitHub Repo

    Currently v{{ site.version }}

      © {{ site.time | date: '%Y' }}. All rights reserved.

	©Thanks to  Jekyll's  butler  Poole


text:
from .edalize_common import make_edalize_test
import os

def test_openlane(make_edalize_test):
    tool_options = {}
    paramtypes = ["vlogdefine"]

    tf = make_edalize_test(
        "openlane", tool_options=tool_options, param_types=paramtypes
    )

    tf.backend.configure()
    tf.backend.build()
    tf.compare_files(["config.tcl", "Makefile", "flow.tcl.cmd"])


text:
package aima.gui.applications.vacuum;

import aima.gui.framework.AgentAppFrame;

/**
 * Adds some selectors to the base class and adjusts its size.
 *
 * @author Ruediger Lunde
 */
public class VacuumFrame extends AgentAppFrame {
	private static final long serialVersionUID = 1L;
	public static String ENV_SEL = "EnvSelection";
	public static String AGENT_SEL = "AgentSelection";

	public VacuumFrame() {
		setTitle("Vacuum Agent Application");
		setSelectors(new String[] { ENV_SEL, AGENT_SEL }, new String[] {
				"Select Environment", "Select Agent" });
		setSelectorItems(ENV_SEL, new String[] { "A/B Deterministic Environment",
				"A/B Non-Deterministic Environment"},
				0);
		setSelectorItems(AGENT_SEL, new String[] {
				"TableDrivenVacuumAgent",
				"ReflexVacuumAgent",
				"SimpleReflexVacuumAgent",
				"ModelBasedReflexVacuumAgent",
				"NondeterministicVacuumAgent" },
				0);
		setEnvView(new VacuumView());
		setSize(800, 400);
	}
}


text:
import errno
import urllib2

from math import radians, cos, sin, asin, sqrt
from socket import error as SocketError

def distance(lat1, long1, lat2, long2):
    """
    Calculate the great circle distance in meters between two points on
    Earth (specified in decimal degrees.)
    Taken on May 1st 2013 from http://stackoverflow.com/a/4913653
    """
    # Convert decimal degrees to radians
    rlong1, rlat1, rlong2, rlat2 = map(radians, [long1, lat1, long2, lat2])
    # Haversine formula
    dlon = rlong2 - rlong1
    dlat = rlat2 - rlat1
    a = sin(dlat / 2) ** 2 + cos(rlat1) * cos(rlat2) * sin(dlon / 2) ** 2
    c = 2 * asin(sqrt(a))
    return 6367 * c * 1000

def forgiving_urlopen(url, attempts=5):
    data = None
    for attempt in range(attempts):
        try:
            data = urllib2.urlopen(url)
            break
        except urllib2.HTTPError:
            continue
        except SocketError as e:
            # Only ignore ECONNRESET
            if e.errno != errno.ECONNRESET:
                raise
            continue
    return data


text:
require 'optparse'

options = {}
opt = OptionParser.new
opt.on('-e ENV', '--env=ENV', 'execute env, equal to RAILS_ENV=env'){|v| options[:env] = v}
opt.parse!(ARGV)

RAILS_ENV = options[:env] if options[:env]

AdminMailer.env_test.deliver!
exit


text:
<?php

namespace PhpOffice\PhpSpreadsheet\Calculation;

class TextData
{
    private static $invalidChars;

    private static function unicodeToOrd($character)
    {
        return unpack('V', iconv('UTF-8', 'UCS-4LE', $character))[1];
    }

    /**
     * CHARACTER
     *
     * @param    string    $character    Value
     * @return    string
     */
    public static function CHARACTER($character)
    {
        $character = Functions::flattenSingleValue($character);

        if ((!is_numeric($character)) || ($character < 0)) {
            return Functions::VALUE();
        }

        if (function_exists('iconv')) {
            return iconv('UCS-4LE', 'UTF-8', pack('V', $character));
        }

        return mb_convert_encoding('&#' . intval($character) . ';', 'UTF-8', 'HTML-ENTITIES');
    }

    /**
     * TRIMNONPRINTABLE
     *
     * @param    mixed    $stringValue    Value to check
     * @return    string
     */
    public static function TRIMNONPRINTABLE($stringValue = '')
    {
        $stringValue = Functions::flattenSingleValue($stringValue);

        if (is_bool($stringValue)) {
            return ($stringValue) ? \PhpOffice\PhpSpreadsheet\Calculation::getTRUE() : \PhpOffice\PhpSpreadsheet\Calculation::getFALSE();
        }

        if (self::$invalidChars == null) {
            self::$invalidChars = range(chr(0), chr(31));
        }

        if (is_string($stringValue) || is_numeric($stringValue)) {
            return str_replace(self::$invalidChars, '', trim($stringValue, "\x00..\x1F"));
        }

        return null;
    }

    /**
     * TRIMSPACES
     *
     * @param    mixed    $stringValue    Value to check
     * @return    string
     */
    public static function TRIMSPACES($stringValue = '')
    {
        $stringValue = Functions::flattenSingleValue($stringValue);
        if (is_bool($stringValue)) {
            return ($stringValue) ? \PhpOffice\PhpSpreadsheet\Calculation::getTRUE() : \PhpOffice\PhpSpreadsheet\Calculation::getFALSE();
        }

        if (is_string($stringValue) || is_numeric($stringValue)) {
            return trim(preg_replace('/ +/', ' ', trim($stringValue, ' ')), ' ');
        }

        return null;
    }

    /**
     * ASCIICODE
     *
     * @param    string    $characters        Value
     * @return    int
     */
    public static function ASCIICODE($characters)
    {
        if (($characters === null) || ($characters === '')) {
            return Functions::VALUE();
        }
        $characters = Functions::flattenSingleValue($characters);
        if (is_bool($characters)) {
            if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE) {
                $characters = (int) $characters;
            } else {
                $characters = ($characters) ? \PhpOffice\PhpSpreadsheet\Calculation::getTRUE() : \PhpOffice\PhpSpreadsheet\Calculation::getFALSE();
            }
        }

        $character = $characters;
        if ((function_exists('mb_strlen')) && (function_exists('mb_substr'))) {
            if (mb_strlen($characters, 'UTF-8') > 1) {
                $character = mb_substr($characters, 0, 1, 'UTF-8');
            }

            return self::unicodeToOrd($character);
        } else {
            if (strlen($characters) > 0) {
                $character = substr($characters, 0, 1);
            }

            return ord($character);
        }
    }

    /**
     * CONCATENATE
     *
     * @return    string
     */
    public static function CONCATENATE()
    {
        $returnValue = '';

        // Loop through arguments
        $aArgs = Functions::flattenArray(func_get_args());
        foreach ($aArgs as $arg) {
            if (is_bool($arg)) {
                if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE) {
                    $arg = (int) $arg;
                } else {
                    $arg = ($arg) ? \PhpOffice\PhpSpreadsheet\Calculation::getTRUE() : \PhpOffice\PhpSpreadsheet\Calculation::getFALSE();
                }
            }
            $returnValue .= $arg;
        }

        return $returnValue;
    }

    /**
     * DOLLAR
     *
     * This function converts a number to text using currency format, with the decimals rounded to the specified place.
     * The format used is $#,##0.00_);($#,##0.00)..
     *
     * @param    float    $value            The value to format
     * @param    int        $decimals        The number of digits to display to the right of the decimal point.
     *                                    If decimals is negative, number is rounded to the left of the decimal point.
     *                                    If you omit decimals, it is assumed to be 2
     * @return    string
     */
    public static function DOLLAR($value = 0, $decimals = 2)
    {
        $value = Functions::flattenSingleValue($value);
        $decimals = is_null($decimals) ? 0 : Functions::flattenSingleValue($decimals);

        // Validate parameters
        if (!is_numeric($value) || !is_numeric($decimals)) {
            return Functions::NAN();
        }
        $decimals = floor($decimals);

        $mask = '$#,##0';
        if ($decimals > 0) {
            $mask .= '.' . str_repeat('0', $decimals);
        } else {
            $round = pow(10, abs($decimals));
            if ($value < 0) {
                $round = 0 - $round;
            }
            $value = MathTrig::MROUND($value, $round);
        }

        return \PhpOffice\PhpSpreadsheet\Style\NumberFormat::toFormattedString($value, $mask);
    }

    /**
     * SEARCHSENSITIVE
     *
     * @param    string    $needle        The string to look for
     * @param    string    $haystack    The string in which to look
     * @param    int        $offset        Offset within $haystack
     * @return    string
     */
    public static function SEARCHSENSITIVE($needle, $haystack, $offset = 1)
    {
        $needle = Functions::flattenSingleValue($needle);
        $haystack = Functions::flattenSingleValue($haystack);
        $offset = Functions::flattenSingleValue($offset);

        if (!is_bool($needle)) {
            if (is_bool($haystack)) {
                $haystack = ($haystack) ? \PhpOffice\PhpSpreadsheet\Calculation::getTRUE() : \PhpOffice\PhpSpreadsheet\Calculation::getFALSE();
            }

            if (($offset > 0) && (\PhpOffice\PhpSpreadsheet\Shared\StringHelper::countCharacters($haystack) > $offset)) {
                if (\PhpOffice\PhpSpreadsheet\Shared\StringHelper::countCharacters($needle) == 0) {
                    return $offset;
                }
                if (function_exists('mb_strpos')) {
                    $pos = mb_strpos($haystack, $needle, --$offset, 'UTF-8');
                } else {
                    $pos = strpos($haystack, $needle, --$offset);
                }
                if ($pos !== false) {
                    return ++$pos;
                }
            }
        }

        return Functions::VALUE();
    }

    /**
     * SEARCHINSENSITIVE
     *
     * @param    string    $needle        The string to look for
     * @param    string    $haystack    The string in which to look
     * @param    int        $offset        Offset within $haystack
     * @return    string
     */
    public static function SEARCHINSENSITIVE($needle, $haystack, $offset = 1)
    {
        $needle = Functions::flattenSingleValue($needle);
        $haystack = Functions::flattenSingleValue($haystack);
        $offset = Functions::flattenSingleValue($offset);

        if (!is_bool($needle)) {
            if (is_bool($haystack)) {
                $haystack = ($haystack) ? \PhpOffice\PhpSpreadsheet\Calculation::getTRUE() : \PhpOffice\PhpSpreadsheet\Calculation::getFALSE();
            }

            if (($offset > 0) && (\PhpOffice\PhpSpreadsheet\Shared\StringHelper::countCharacters($haystack) > $offset)) {
                if (\PhpOffice\PhpSpreadsheet\Shared\StringHelper::countCharacters($needle) == 0) {
                    return $offset;
                }
                if (function_exists('mb_stripos')) {
                    $pos = mb_stripos($haystack, $needle, --$offset, 'UTF-8');
                } else {
                    $pos = stripos($haystack, $needle, --$offset);
                }
                if ($pos !== false) {
                    return ++$pos;
                }
            }
        }

        return Functions::VALUE();
    }

    /**
     * FIXEDFORMAT
     *
     * @param    mixed        $value    Value to check
     * @param    int        $decimals
     * @param    bool        $no_commas
     * @return    string
     */
    public static function FIXEDFORMAT($value, $decimals = 2, $no_commas = false)
    {
        $value = Functions::flattenSingleValue($value);
        $decimals = Functions::flattenSingleValue($decimals);
        $no_commas = Functions::flattenSingleValue($no_commas);

        // Validate parameters
        if (!is_numeric($value) || !is_numeric($decimals)) {
            return Functions::NAN();
        }
        $decimals = floor($decimals);

        $valueResult = round($value, $decimals);
        if ($decimals < 0) {
            $decimals = 0;
        }
        if (!$no_commas) {
            $valueResult = number_format($valueResult, $decimals);
        }

        return (string) $valueResult;
    }

    /**
     * LEFT
     *
     * @param    string    $value    Value
     * @param    int        $chars    Number of characters
     * @return    string
     */
    public static function LEFT($value = '', $chars = 1)
    {
        $value = Functions::flattenSingleValue($value);
        $chars = Functions::flattenSingleValue($chars);

        if ($chars < 0) {
            return Functions::VALUE();
        }

        if (is_bool($value)) {
            $value = ($value) ? \PhpOffice\PhpSpreadsheet\Calculation::getTRUE() : \PhpOffice\PhpSpreadsheet\Calculation::getFALSE();
        }

        if (function_exists('mb_substr')) {
            return mb_substr($value, 0, $chars, 'UTF-8');
        } else {
            return substr($value, 0, $chars);
        }
    }

    /**
     * MID
     *
     * @param    string    $value    Value
     * @param    int        $start    Start character
     * @param    int        $chars    Number of characters
     * @return    string
     */
    public static function MID($value = '', $start = 1, $chars = null)
    {
        $value = Functions::flattenSingleValue($value);
        $start = Functions::flattenSingleValue($start);
        $chars = Functions::flattenSingleValue($chars);

        if (($start < 1) || ($chars < 0)) {
            return Functions::VALUE();
        }

        if (is_bool($value)) {
            $value = ($value) ? \PhpOffice\PhpSpreadsheet\Calculation::getTRUE() : \PhpOffice\PhpSpreadsheet\Calculation::getFALSE();
        }

        if (empty($chars)) {
            return '';
        }
        if (function_exists('mb_substr')) {
            return mb_substr($value, --$start, $chars, 'UTF-8');
        } else {
            return substr($value, --$start, $chars);
        }
    }

    /**
     * RIGHT
     *
     * @param    string    $value    Value
     * @param    int        $chars    Number of characters
     * @return    string
     */
    public static function RIGHT($value = '', $chars = 1)
    {
        $value = Functions::flattenSingleValue($value);
        $chars = Functions::flattenSingleValue($chars);

        if ($chars < 0) {
            return Functions::VALUE();
        }

        if (is_bool($value)) {
            $value = ($value) ? \PhpOffice\PhpSpreadsheet\Calculation::getTRUE() : \PhpOffice\PhpSpreadsheet\Calculation::getFALSE();
        }

        if ((function_exists('mb_substr')) && (function_exists('mb_strlen'))) {
            return mb_substr($value, mb_strlen($value, 'UTF-8') - $chars, $chars, 'UTF-8');
        } else {
            return substr($value, strlen($value) - $chars);
        }
    }

    /**
     * STRINGLENGTH
     *
     * @param    string    $value    Value
     * @return    int
     */
    public static function STRINGLENGTH($value = '')
    {
        $value = Functions::flattenSingleValue($value);

        if (is_bool($value)) {
            $value = ($value) ? \PhpOffice\PhpSpreadsheet\Calculation::getTRUE() : \PhpOffice\PhpSpreadsheet\Calculation::getFALSE();
        }

        if (function_exists('mb_strlen')) {
            return mb_strlen($value, 'UTF-8');
        } else {
            return strlen($value);
        }
    }

    /**
     * LOWERCASE
     *
     * Converts a string value to upper case.
     *
     * @param    string        $mixedCaseString
     * @return    string
     */
    public static function LOWERCASE($mixedCaseString)
    {
        $mixedCaseString = Functions::flattenSingleValue($mixedCaseString);

        if (is_bool($mixedCaseString)) {
            $mixedCaseString = ($mixedCaseString) ? \PhpOffice\PhpSpreadsheet\Calculation::getTRUE() : \PhpOffice\PhpSpreadsheet\Calculation::getFALSE();
        }

        return \PhpOffice\PhpSpreadsheet\Shared\StringHelper::strToLower($mixedCaseString);
    }

    /**
     * UPPERCASE
     *
     * Converts a string value to upper case.
     *
     * @param    string        $mixedCaseString
     * @return    string
     */
    public static function UPPERCASE($mixedCaseString)
    {
        $mixedCaseString = Functions::flattenSingleValue($mixedCaseString);

        if (is_bool($mixedCaseString)) {
            $mixedCaseString = ($mixedCaseString) ? \PhpOffice\PhpSpreadsheet\Calculation::getTRUE() : \PhpOffice\PhpSpreadsheet\Calculation::getFALSE();
        }

        return \PhpOffice\PhpSpreadsheet\Shared\StringHelper::strToUpper($mixedCaseString);
    }

    /**
     * PROPERCASE
     *
     * Converts a string value to upper case.
     *
     * @param    string        $mixedCaseString
     * @return    string
     */
    public static function PROPERCASE($mixedCaseString)
    {
        $mixedCaseString = Functions::flattenSingleValue($mixedCaseString);

        if (is_bool($mixedCaseString)) {
            $mixedCaseString = ($mixedCaseString) ? \PhpOffice\PhpSpreadsheet\Calculation::getTRUE() : \PhpOffice\PhpSpreadsheet\Calculation::getFALSE();
        }

        return \PhpOffice\PhpSpreadsheet\Shared\StringHelper::strToTitle($mixedCaseString);
    }

    /**
     * REPLACE
     *
     * @param    string    $oldText    String to modify
     * @param    int        $start        Start character
     * @param    int        $chars        Number of characters
     * @param    string    $newText    String to replace in defined position
     * @return    string
     */
    public static function REPLACE($oldText, $start, $chars, $newText)
    {
        $oldText = Functions::flattenSingleValue($oldText);
        $start = Functions::flattenSingleValue($start);
        $chars = Functions::flattenSingleValue($chars);
        $newText = Functions::flattenSingleValue($newText);

        $left = self::LEFT($oldText, $start - 1);
        $right = self::RIGHT($oldText, self::STRINGLENGTH($oldText) - ($start + $chars) + 1);

        return $left . $newText . $right;
    }

    /**
     * SUBSTITUTE
     *
     * @param    string    $text        Value
     * @param    string    $fromText    From Value
     * @param    string    $toText        To Value
     * @param    int    $instance    Instance Number
     * @return    string
     */
    public static function SUBSTITUTE($text = '', $fromText = '', $toText = '', $instance = 0)
    {
        $text = Functions::flattenSingleValue($text);
        $fromText = Functions::flattenSingleValue($fromText);
        $toText = Functions::flattenSingleValue($toText);
        $instance = floor(Functions::flattenSingleValue($instance));

        if ($instance == 0) {
            if (function_exists('mb_str_replace')) {
                return mb_str_replace($fromText, $toText, $text);
            } else {
                return str_replace($fromText, $toText, $text);
            }
        } else {
            $pos = -1;
            while ($instance > 0) {
                if (function_exists('mb_strpos')) {
                    $pos = mb_strpos($text, $fromText, $pos + 1, 'UTF-8');
                } else {
                    $pos = strpos($text, $fromText, $pos + 1);
                }
                if ($pos === false) {
                    break;
                }
                --$instance;
            }
            if ($pos !== false) {
                if (function_exists('mb_strlen')) {
                    return self::REPLACE($text, ++$pos, mb_strlen($fromText, 'UTF-8'), $toText);
                } else {
                    return self::REPLACE($text, ++$pos, strlen($fromText), $toText);
                }
            }
        }

        return $text;
    }

    /**
     * RETURNSTRING
     *
     * @param    mixed    $testValue    Value to check
     * @return    string|null
     */
    public static function RETURNSTRING($testValue = '')
    {
        $testValue = Functions::flattenSingleValue($testValue);

        if (is_string($testValue)) {
            return $testValue;
        }

        return null;
    }

    /**
     * TEXTFORMAT
     *
     * @param    mixed    $value    Value to check
     * @param    string    $format    Format mask to use
     * @return    string
     */
    public static function TEXTFORMAT($value, $format)
    {
        $value = Functions::flattenSingleValue($value);
        $format = Functions::flattenSingleValue($format);

        if ((is_string($value)) && (!is_numeric($value)) && \PhpOffice\PhpSpreadsheet\Shared\Date::isDateTimeFormatCode($format)) {
            $value = DateTime::DATEVALUE($value);
        }

        return (string) \PhpOffice\PhpSpreadsheet\Style\NumberFormat::toFormattedString($value, $format);
    }

    /**
     * VALUE
     *
     * @param    mixed    $value    Value to check
     * @return    bool
     */
    public static function VALUE($value = '')
    {
        $value = Functions::flattenSingleValue($value);

        if (!is_numeric($value)) {
            $numberValue = str_replace(
                \PhpOffice\PhpSpreadsheet\Shared\StringHelper::getThousandsSeparator(),
                '',
                trim($value, " \t\n\r\0\x0B" . \PhpOffice\PhpSpreadsheet\Shared\StringHelper::getCurrencyCode())
            );
            if (is_numeric($numberValue)) {
                return (float) $numberValue;
            }

            $dateSetting = Functions::getReturnDateType();
            Functions::setReturnDateType(Functions::RETURNDATE_EXCEL);

            if (strpos($value, ':') !== false) {
                $timeValue = DateTime::TIMEVALUE($value);
                if ($timeValue !== Functions::VALUE()) {
                    Functions::setReturnDateType($dateSetting);

                    return $timeValue;
                }
            }
            $dateValue = DateTime::DATEVALUE($value);
            if ($dateValue !== Functions::VALUE()) {
                Functions::setReturnDateType($dateSetting);

                return $dateValue;
            }
            Functions::setReturnDateType($dateSetting);

            return Functions::VALUE();
        }

        return (float) $value;
    }
}


text:
<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wikidot="http://www.wikidot.com/rss-namespace">

	<channel>
		<title>So, referral question...</title>
		<link>http://bvs.wikidot.com/forum/t-173167/so-referral-question</link>
		<description>Posts in the discussion thread "So, referral question..." - Can I use my desktop computer for a new character?</description>
				<copyright></copyright>
		<lastBuildDate>Sun, 10 Jul 2022 05:08:38 +0000</lastBuildDate>

					<item>
				<guid>http://bvs.wikidot.com/forum/t-173167#post-550594</guid>
				<title>Re: So, referral question...</title>
				<link>http://bvs.wikidot.com/forum/t-173167/so-referral-question#post-550594</link>
				<description></description>
				<pubDate>Sat, 01 Aug 2009 19:52:36 +0000</pubDate>
				<wikidot:authorName>Faroth</wikidot:authorName>				<wikidot:authorUserId>298298</wikidot:authorUserId>				<content:encoded>
					<![CDATA[

If the computer in question is on the same network you most likely have the same IP address externally to the Internet. Because of this you won't get any referral points for any new alts. However you are allowed to make 3 characters so there's nothing stopping you from playing one of each bloodline at the same time.

If you for some reason have several unique IP's you might get referrals but there is supposedly some other method the system uses to spot cheating. Though I doubt you'll get smashed with the Banhammer for it you might get a warning if you do try it.

				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://bvs.wikidot.com/forum/t-173167#post-550514</guid>
				<title>So, referral question...</title>
				<link>http://bvs.wikidot.com/forum/t-173167/so-referral-question#post-550514</link>
				<description></description>
				<pubDate>Sat, 01 Aug 2009 17:06:44 +0000</pubDate>
				<wikidot:authorName>Davinator</wikidot:authorName>				<wikidot:authorUserId>352682</wikidot:authorUserId>				<content:encoded>
					<![CDATA[

So, the way I work, I have multiple desktops at home with which I am free to do with as I please. Question is, am I gonna' get a big old BANHAMMER to the face if I create an account on one of these computers to try different stuff out and get a referral point? Nothing IP related, just wondered if 11DBHK would be watching me. Thanks in advance! (Also, first post WOOO)

				 	]]>
				</content:encoded>							</item>
				</channel>
</rss>


text:
package org.elasticsearch.client.security;

import org.elasticsearch.client.Validatable;

import java.util.Objects;

/**
 * Abstract request object to enable or disable a built-in or native user.
 */
public abstract class SetUserEnabledRequest implements Validatable {

    private final boolean enabled;
    private final String username;
    private final RefreshPolicy refreshPolicy;

    SetUserEnabledRequest(boolean enabled, String username, RefreshPolicy refreshPolicy) {
        this.enabled = enabled;
        this.username = Objects.requireNonNull(username, "username is required");
        this.refreshPolicy = refreshPolicy == null ? RefreshPolicy.getDefault() : refreshPolicy;
    }

    public boolean isEnabled() {
        return enabled;
    }

    public String getUsername() {
        return username;
    }

    public RefreshPolicy getRefreshPolicy() {
        return refreshPolicy;
    }
}


text:
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

namespace Microsoft.Azure.Devices.Client
{
    using System.Threading.Tasks;

    static class DotNetHelpers
    {
        public static Task<T> AsTaskOrAsyncOp<T>(this Task<T> op) { return op; }
        public static Task AsTaskOrAsyncOp(this Task op) { return op; }
    }
}


text:
package blue.lapis.pore.impl.event.entity;

import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Preconditions.checkState;

import blue.lapis.pore.converter.ItemStackConverter;
import blue.lapis.pore.converter.type.EntityConverter;
import blue.lapis.pore.impl.entity.PoreLivingEntity;

import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.inventory.ItemStack;
import org.spongepowered.api.entity.Item;
import org.spongepowered.api.entity.living.Living;

import java.util.ArrayList;
import java.util.List;

public class PoreEntityDeathEvent extends org.bukkit.event.entity.EntityDeathEvent {

    private final org.spongepowered.api.event.entity.EntityDeathEvent handle;

    public PoreEntityDeathEvent(org.spongepowered.api.event.entity.EntityDeathEvent handle) {
        super(null, null);
        this.handle = checkNotNull(handle, "handle");
        checkState(handle.getEntity() instanceof Living, "Bad entity type");
    }

    public org.spongepowered.api.event.entity.EntityDeathEvent getHandle() {
        return this.handle;
    }

    @Override
    public LivingEntity getEntity() {
        return (LivingEntity) PoreLivingEntity.of(this.getHandle().getEntity());
    }

    @Override
    public EntityType getEntityType() {
        return EntityConverter.of(this.getHandle().getEntity().getType());
    }

    @Override
    public int getDroppedExp() {
        return this.getHandle().getExp();
    }

    @Override
    public void setDroppedExp(int exp) {
        this.getHandle().setExp(exp);
    }

    @Override
    public List<ItemStack> getDrops() {
        // not sure if there's a better way of doing this, but the conversions are kind of weird
        List<ItemStack> items = new ArrayList<ItemStack>();
        for (Item item : this.getHandle().getDroppedItems()) {
            items.add(ItemStackConverter.of(item.getItemStack()));
        }
        return items;
    }
}


text:
@implementation SLLRSSEntry

-(SLLRSSEntry *)init
{
    self = [super init];

    return self;
}

- (NSString *)description
{
    return [NSString stringWithFormat:@"SLLRSSEntry, title:%@, date:%@, author:%@, link:%@, imageUrL:%@", self.title, self.date, self.author, self.link, self.imageUrl];
}

@end


text:
#ifndef __NE_INDIRECT__
#error "Please import the NetworkExtension module instead of this file directly."
#endif

NS_ASSUME_NONNULL_BEGIN

/*!
 * @file NEPacketTunnelFlow.h
 * @discussion This file declares the NEPacketTunnelFlow API. The NEPacketTunnelFlow is used by NEPacketTunnelProvider implementations to tunnel IP packets.
 */

/*!
 * @interface NEPacketTunnelFlow
 * @discussion The NEPacketTunnelFlow class declares the programmatic interface of an object that is used by NEPacketTunnelProvider implementations to tunnel IP packets.
 *
 * NEPacketTunnelFlow is part of NetworkExtension.framework
 *
 * Instances of this class are thread safe.
 */
NS_CLASS_AVAILABLE(10_11, 9_0)
@interface NEPacketTunnelFlow : NSObject

/*!
 * @method readPacketsWithCompletionHandler:
 * @discussion Read available IP packets from the flow.
 * @param completionHandler A block that will be executed to handle the packets. This block takes an array of NSData objects and an array of NSNumber objects. The NSData and NSNumber in corresponding indicies in the array represent one packet. If after handling the packets the caller wants to read more packets then the caller must call this method again.
 */
- (void)readPacketsWithCompletionHandler:(void (^)(NSArray<NSData *> *packets, NSArray<NSNumber *> *protocols))completionHandler NS_AVAILABLE(10_11, 9_0);

/*!
 * @method writePackets:completionHandler:
 * @discussion Write multiple IP packets to the flow.
 * @param packets An array of NSData objects, each containing packet data to be written.
 * @param protocols An array of NSNumber objects. Each number contains the protocol of the packet in the corresponding index in the packets array.
 */
- (BOOL)writePackets:(NSArray<NSData *> *)packets withProtocols:(NSArray<NSNumber *> *)protocols NS_AVAILABLE(10_11, 9_0);

@end

NS_ASSUME_NONNULL_END


text:
package edu.mayo.mprc.daemon;

import edu.mayo.mprc.daemon.worker.WorkPacket;
import edu.mayo.mprc.utilities.progress.ProgressReporter;

import java.io.File;
import java.util.List;

/**
 * A work packet whose results can be cached.
 *

 *

 * Can describe itself using a unique string that can then be hashed
 * using the cache.
 *

 * Can translate itself into another work packet that will produce results into the cache folder.
 *

 * Can provide a timestamp determining at least how new must the cached result be to be useful.
 *

 * Given a cache folder, it can simulate the execution of the worker and report the results as if they were just made.
 *

 * It knows whether the user demands the resulting files to be placed at the original location, or whether they are okay
 * with running from the cache folders. It provides a main output file whose parent folder is where all the result files
 * will be copied to by the cache.
 *

 */
public interface CachableWorkPacket extends WorkPacket {
	/**
	 * @return True if the results of this work packet should be made publicly available to the user
	 * (not just stored in the intermediate result cache).
	 */
	boolean isPublishResultFiles();

	/**
	 * @return The main resulting output file. Its parent folder is the destination to put all the cached results
	 * to in case the user asks for {@link #isPublishResultFiles()}
	 */
	File getOutputFile();

	/**
	 * For given work packet, obtain a string that describes the work to be done.
	 * When two of these strings are identical, the two tasks are identical and their results
	 * are fully interchangeable.
	 */
	String getStringDescriptionOfTask();

	/**
	 * The original work packet requested files somewhere.
	 * Translate the work packet to one that requests the files to be put into the work in progress folder of the cache.
	 * This translation should also make the output file name canonical - depending solely on the input parameters.
	 * This way if user requests two runs with two differently named output files, we can hit the same cache and rename
	 * the files for them if they so desire.
	 *
	 * @param cacheFolder The folder where the cache copy should go
	 * @return New work packet that puts files into the WIP folder of the cache
	 */
	WorkPacket translateToCachePacket(File cacheFolder);

	/**
	 * @return A list of all output files that are expected to be a result of processing this work packet. Just names, no paths.
	 */
	List<String> getOutputFiles();

	/**
	 * @param subFolder   Cache subfolder with output files.
	 * @param outputFiles List of output files as previously generated.
	 * @return True if cached output in a particular folder is stale (older than the input files)
	 */
	boolean cacheIsStale(File subFolder, List<String> outputFiles);

	/**
	 * Report that the original work packet got processed and its resulting files are in a given folder.
	 *
	 * @param reporter     The object to report the result on.
	 * @param targetFolder Folder with the output files (cache)
	 * @param outputFiles  List of the output files (previously obtained by {@link #getOutputFiles()}/
	 */
	void reportCachedResult(ProgressReporter reporter, File targetFolder, List<String> outputFiles);
}


text:
'use strict';

(function() {
	// Serviceroutes Controller Spec
	describe('Serviceroutes Controller Tests', function() {
		// Initialize global variables
		var ServiceroutesController,
		scope,
		$httpBackend,
		$stateParams,
		$location;

		// The $resource service augments the response object with methods for updating and deleting the resource.
		// If we were to use the standard toEqual matcher, our tests would fail because the test values would not match
		// the responses exactly. To solve the problem, we define a new toEqualData Jasmine matcher.
		// When the toEqualData matcher compares two objects, it takes only object properties into
		// account and ignores methods.
		beforeEach(function() {
			jasmine.addMatchers({
				toEqualData: function(util, customEqualityTesters) {
					return {
						compare: function(actual, expected) {
							return {
								pass: angular.equals(actual, expected)
							};
						}
					};
				}
			});
		});

		// Then we can start by loading the main application module
		beforeEach(module(ApplicationConfiguration.applicationModuleName));

		// The injector ignores leading and trailing underscores here (i.e. _$httpBackend_).
		// This allows us to inject a service but then attach it to a variable
		// with the same name as the service.
		beforeEach(inject(function($controller, $rootScope, _$location_, _$stateParams_, _$httpBackend_) {
			// Set a new global scope
			scope = $rootScope.$new();

			// Point global variables to injected services
			$stateParams = _$stateParams_;
			$httpBackend = _$httpBackend_;
			$location = _$location_;

			// Initialize the Serviceroutes controller.
			ServiceroutesController = $controller('ServiceroutesController', {
				$scope: scope
			});
		}));

		it('$scope.find() should create an array with at least one Serviceroute object fetched from XHR', inject(function(Serviceroutes) {
			// Create sample Serviceroute using the Serviceroutes service
			var sampleServiceroute = new Serviceroutes({
				name: 'New Serviceroute'
			});

			// Create a sample Serviceroutes array that includes the new Serviceroute
			var sampleServiceroutes = [sampleServiceroute];

			// Set GET response
			$httpBackend.expectGET('serviceroutes').respond(sampleServiceroutes);

			// Run controller functionality
			scope.find();
			$httpBackend.flush();

			// Test scope value
			expect(scope.serviceroutes).toEqualData(sampleServiceroutes);
		}));

		it('$scope.findOne() should create an array with one Serviceroute object fetched from XHR using a servicerouteId URL parameter', inject(function(Serviceroutes) {
			// Define a sample Serviceroute object
			var sampleServiceroute = new Serviceroutes({
				name: 'New Serviceroute'
			});

			// Set the URL parameter
			$stateParams.servicerouteId = '525a8422f6d0f87f0e407a33';

			// Set GET response
			$httpBackend.expectGET(/serviceroutes\/([0-9a-fA-F]{24})$/).respond(sampleServiceroute);

			// Run controller functionality
			scope.findOne();
			$httpBackend.flush();

			// Test scope value
			expect(scope.serviceroute).toEqualData(sampleServiceroute);
		}));

		it('$scope.create() with valid form data should send a POST request with the form input values and then locate to new object URL', inject(function(Serviceroutes) {
			// Create a sample Serviceroute object
			var sampleServiceroutePostData = new Serviceroutes({
				name: 'New Serviceroute'
			});

			// Create a sample Serviceroute response
			var sampleServicerouteResponse = new Serviceroutes({
				_id: '525cf20451979dea2c000001',
				name: 'New Serviceroute'
			});

			// Fixture mock form input values
			scope.name = 'New Serviceroute';

			// Set POST response
			$httpBackend.expectPOST('serviceroutes', sampleServiceroutePostData).respond(sampleServicerouteResponse);

			// Run controller functionality
			scope.create();
			$httpBackend.flush();

			// Test form inputs are reset
			expect(scope.name).toEqual('');

			// Test URL redirection after the Serviceroute was created
			expect($location.path()).toBe('/serviceroutes/' + sampleServicerouteResponse._id);
		}));

		it('$scope.update() should update a valid Serviceroute', inject(function(Serviceroutes) {
			// Define a sample Serviceroute put data
			var sampleServiceroutePutData = new Serviceroutes({
				_id: '525cf20451979dea2c000001',
				name: 'New Serviceroute'
			});

			// Mock Serviceroute in scope
			scope.serviceroute = sampleServiceroutePutData;

			// Set PUT response
			$httpBackend.expectPUT(/serviceroutes\/([0-9a-fA-F]{24})$/).respond();

			// Run controller functionality
			scope.update();
			$httpBackend.flush();

			// Test URL location to new object
			expect($location.path()).toBe('/serviceroutes/' + sampleServiceroutePutData._id);
		}));

		it('$scope.remove() should send a DELETE request with a valid servicerouteId and remove the Serviceroute from the scope', inject(function(Serviceroutes) {
			// Create new Serviceroute object
			var sampleServiceroute = new Serviceroutes({
				_id: '525a8422f6d0f87f0e407a33'
			});

			// Create new Serviceroutes array and include the Serviceroute
			scope.serviceroutes = [sampleServiceroute];

			// Set expected DELETE response
			$httpBackend.expectDELETE(/serviceroutes\/([0-9a-fA-F]{24})$/).respond(204);

			// Run controller functionality
			scope.remove(sampleServiceroute);
			$httpBackend.flush();

			// Test array after successful delete
			expect(scope.serviceroutes.length).toBe(0);
		}));
	});
}());


text:
'use strict';

var grunt = require('grunt');

/*
  ======== A Handy Little Nodeunit Reference ========
  https://github.com/caolan/nodeunit

  Test methods:
    test.expect(numAssertions)
    test.done()
  Test assertions:
    test.ok(value, [message])
    test.equal(actual, expected, [message])
    test.notEqual(actual, expected, [message])
    test.deepEqual(actual, expected, [message])
    test.notDeepEqual(actual, expected, [message])
    test.strictEqual(actual, expected, [message])
    test.notStrictEqual(actual, expected, [message])
    test.throws(block, [error], [message])
    test.doesNotThrow(block, [error], [message])
    test.ifError(value)
*/

exports.custom_styleguide = {
  setUp: function(done) {
    // setup here if necessary
    done();
  },

  shouldCreateAStyleguideFromMultipleStylesheetsUsingMarkdownProcessor: function(test) {
    test.expect(1);

    var actual = grunt.file.read('tmp/styleguide_from_multiple_css_files_using_markdown_test.html');
    var expected = grunt.file.read('test/expected/styleguide_from_multiple_css_files_using_markdown_test.html');
    test.equal(actual, expected, 'should create a styleguide from multiple css files using the markdown processor.');

    test.done();
  },

  shouldBePossibleToProvideCustomProcessorWithCustomProcessFunction: function(test) {
    test.expect(1);

    var actual = grunt.file.read('tmp/custom_styleguide_processor_test.html');
    var expected = grunt.file.read('test/expected/custom_styleguide_processor_test.html');
    test.equal(actual, expected, 'should be possible to provide custom processor with custom process function.');

    test.done();
  }
};


text:
using System;
using System.Linq;
using DocsBr.Utils;

namespace DocsBr.Validation.IE
{
    /// <summary>
    /// Validação da IE do Pará
    /// </summary>
    /// <remarks>
    /// ROTEIRO DE CRÍTICA DA INSCRIÇÃO ESTADUAL:
    ///   http://www.sintegra.gov.br/Cad_Estados/cad_PA.html
    /// </remarks>
    public class IEParaValidator : IIEValidator
    {
        private string inscEstadual;

        public IEParaValidator(string inscEstadual)
        {
            this.inscEstadual = new OnlyNumbers(inscEstadual).ToString();
        }

        public bool IsValid()
        {
            if (!IsSizeValid()) return false;
            if (!BeginsCorrectly()) return false;
            return HasValidCheckDigits();
        }

        private bool IsSizeValid()
        {
            return this.inscEstadual.Length == 9;
        }

        private bool BeginsCorrectly()
        {
            return this.inscEstadual.Substring(0, 2) == "15";
        }

        private bool HasValidCheckDigits()
        {
            string number = this.inscEstadual.Substring(0, this.inscEstadual.Length - 1);

            DigitoVerificador digitoVerificador = new DigitoVerificador(number)
                                                        .ComMultiplicadoresDeAte(2, 9)
                                                        .Substituindo("0", 10, 11);
            return digitoVerificador.CalculaDigito() == this.inscEstadual.Substring(this.inscEstadual.Length - 1, 1);
        }
    }
}


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

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

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(TranslateForm));
            this.btnQuit = new System.Windows.Forms.Button();
            this.btnSave = new System.Windows.Forms.Button();
            this.lblSourceTranslationFile = new System.Windows.Forms.Label();
            this.lblDestinationTranslationFile = new System.Windows.Forms.Label();
            this.tbxSourceTranslationFile = new System.Windows.Forms.TextBox();
            this.tbxDestinationTranslationFile = new System.Windows.Forms.TextBox();
            this.btnLoadSourceTranslation = new System.Windows.Forms.Button();
            this.btnLoadDestinationTranslation = new System.Windows.Forms.Button();
            this.label1 = new System.Windows.Forms.Label();
            this.panel1 = new System.Windows.Forms.Panel();
            this.grid1 = new SourceGrid.Grid();
            this.btnPopulateTranslations = new System.Windows.Forms.Button();
            this.statusStrip1 = new System.Windows.Forms.StatusStrip();
            this.progressBar = new System.Windows.Forms.ToolStripProgressBar();
            this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel();
            this.checkPendingOnly = new System.Windows.Forms.CheckBox();
            this.panel1.SuspendLayout();
            this.statusStrip1.SuspendLayout();
            this.SuspendLayout();
            //
            // btnQuit
            //
            this.btnQuit.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
            this.btnQuit.Location = new System.Drawing.Point(793, 622);
            this.btnQuit.Name = "btnQuit";
            this.btnQuit.Size = new System.Drawing.Size(75, 23);
            this.btnQuit.TabIndex = 0;
            this.btnQuit.Text = "&Quit";
            this.btnQuit.UseVisualStyleBackColor = true;
            this.btnQuit.Click += new System.EventHandler(this.BtnQuitClick);
            //
            // btnSave
            //
            this.btnSave.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
            this.btnSave.Enabled = false;
            this.btnSave.Location = new System.Drawing.Point(672, 622);
            this.btnSave.Name = "btnSave";
            this.btnSave.Size = new System.Drawing.Size(115, 23);
            this.btnSave.TabIndex = 3;
            this.btnSave.Text = "Save Language";
            this.btnSave.UseVisualStyleBackColor = true;
            this.btnSave.Click += new System.EventHandler(this.BtnSaveClick);
            //
            // lblSourceTranslationFile
            //
            this.lblSourceTranslationFile.AutoSize = true;
            this.lblSourceTranslationFile.Location = new System.Drawing.Point(9, 9);
            this.lblSourceTranslationFile.Name = "lblSourceTranslationFile";
            this.lblSourceTranslationFile.Size = new System.Drawing.Size(171, 13);
            this.lblSourceTranslationFile.TabIndex = 4;
            this.lblSourceTranslationFile.Text = "Source translation file (english.xml):";
            //
            // lblDestinationTranslationFile
            //
            this.lblDestinationTranslationFile.AutoSize = true;
            this.lblDestinationTranslationFile.Location = new System.Drawing.Point(9, 48);
            this.lblDestinationTranslationFile.Name = "lblDestinationTranslationFile";
            this.lblDestinationTranslationFile.Size = new System.Drawing.Size(130, 13);
            this.lblDestinationTranslationFile.TabIndex = 5;
            this.lblDestinationTranslationFile.Text = "Destination translation file:";
            //
            // tbxSourceTranslationFile
            //
            this.tbxSourceTranslationFile.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
            | System.Windows.Forms.AnchorStyles.Right)));
            this.tbxSourceTranslationFile.Location = new System.Drawing.Point(12, 25);
            this.tbxSourceTranslationFile.Name = "tbxSourceTranslationFile";
            this.tbxSourceTranslationFile.ReadOnly = true;
            this.tbxSourceTranslationFile.Size = new System.Drawing.Size(544, 20);
            this.tbxSourceTranslationFile.TabIndex = 6;
            //
            // tbxDestinationTranslationFile
            //
            this.tbxDestinationTranslationFile.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
            | System.Windows.Forms.AnchorStyles.Right)));
            this.tbxDestinationTranslationFile.Location = new System.Drawing.Point(12, 64);
            this.tbxDestinationTranslationFile.Name = "tbxDestinationTranslationFile";
            this.tbxDestinationTranslationFile.ReadOnly = true;
            this.tbxDestinationTranslationFile.Size = new System.Drawing.Size(544, 20);
            this.tbxDestinationTranslationFile.TabIndex = 7;
            //
            // btnLoadSourceTranslation
            //
            this.btnLoadSourceTranslation.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            this.btnLoadSourceTranslation.Location = new System.Drawing.Point(562, 23);
            this.btnLoadSourceTranslation.Name = "btnLoadSourceTranslation";
            this.btnLoadSourceTranslation.Size = new System.Drawing.Size(165, 23);
            this.btnLoadSourceTranslation.TabIndex = 8;
            this.btnLoadSourceTranslation.Text = "Select source translation...";
            this.btnLoadSourceTranslation.UseVisualStyleBackColor = true;
            this.btnLoadSourceTranslation.Click += new System.EventHandler(this.BtnLoadSourceTranslationClick);
            //
            // btnLoadDestinationTranslation
            //
            this.btnLoadDestinationTranslation.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            this.btnLoadDestinationTranslation.Location = new System.Drawing.Point(562, 62);
            this.btnLoadDestinationTranslation.Name = "btnLoadDestinationTranslation";
            this.btnLoadDestinationTranslation.Size = new System.Drawing.Size(165, 23);
            this.btnLoadDestinationTranslation.TabIndex = 9;
            this.btnLoadDestinationTranslation.Text = "Select destination translation...";
            this.btnLoadDestinationTranslation.UseVisualStyleBackColor = true;
            this.btnLoadDestinationTranslation.Click += new System.EventHandler(this.BtnLoadDestinationTranslationClick);
            //
            // label1
            //
            this.label1.AutoSize = true;
            this.label1.ForeColor = System.Drawing.Color.Red;
            this.label1.Location = new System.Drawing.Point(9, 625);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(250, 13);
            this.label1.TabIndex = 11;
            this.label1.Text = "Red text = untranslated (equal to source translation)";
            //
            // panel1
            //
            this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
            | System.Windows.Forms.AnchorStyles.Left)
            | System.Windows.Forms.AnchorStyles.Right)));
            this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.panel1.Controls.Add(this.grid1);
            this.panel1.Location = new System.Drawing.Point(12, 109);
            this.panel1.Name = "panel1";
            this.panel1.Size = new System.Drawing.Size(856, 507);
            this.panel1.TabIndex = 12;
            //
            // grid1
            //
            this.grid1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
            | System.Windows.Forms.AnchorStyles.Left)
            | System.Windows.Forms.AnchorStyles.Right)));
            this.grid1.EnableSort = true;
            this.grid1.Location = new System.Drawing.Point(3, 3);
            this.grid1.Name = "grid1";
            this.grid1.OptimizeMode = SourceGrid.CellOptimizeMode.ForRows;
            this.grid1.SelectionMode = SourceGrid.GridSelectionMode.Cell;
            this.grid1.Size = new System.Drawing.Size(848, 499);
            this.grid1.TabIndex = 5;
            this.grid1.TabStop = true;
            this.grid1.ToolTipText = "";
            //
            // btnPopulateTranslations
            //
            this.btnPopulateTranslations.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            this.btnPopulateTranslations.Location = new System.Drawing.Point(733, 61);
            this.btnPopulateTranslations.Name = "btnPopulateTranslations";
            this.btnPopulateTranslations.Size = new System.Drawing.Size(143, 23);
            this.btnPopulateTranslations.TabIndex = 13;
            this.btnPopulateTranslations.Text = "Populate translation";
            this.btnPopulateTranslations.UseVisualStyleBackColor = true;
            this.btnPopulateTranslations.Click += new System.EventHandler(this.BtnPopulateTranslationsClick);
            //
            // statusStrip1
            //
            this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.progressBar,
            this.toolStripStatusLabel1});
            this.statusStrip1.Location = new System.Drawing.Point(0, 651);
            this.statusStrip1.Name = "statusStrip1";
            this.statusStrip1.Size = new System.Drawing.Size(880, 22);
            this.statusStrip1.TabIndex = 14;
            this.statusStrip1.Text = "statusStrip1";
            //
            // progressBar
            //
            this.progressBar.Name = "progressBar";
            this.progressBar.Size = new System.Drawing.Size(400, 16);
            //
            // toolStripStatusLabel1
            //
            this.toolStripStatusLabel1.Name = "toolStripStatusLabel1";
            this.toolStripStatusLabel1.Size = new System.Drawing.Size(37, 17);
            this.toolStripStatusLabel1.Text = "          ";
            //
            // checkPendingOnly
            //
            this.checkPendingOnly.AutoSize = true;
            this.checkPendingOnly.Location = new System.Drawing.Point(12, 86);
            this.checkPendingOnly.Name = "checkPendingOnly";
            this.checkPendingOnly.Size = new System.Drawing.Size(177, 17);
            this.checkPendingOnly.TabIndex = 15;
            this.checkPendingOnly.Text = "Show only Pending Translations";
            this.checkPendingOnly.UseVisualStyleBackColor = true;
            this.checkPendingOnly.CheckedChanged += new System.EventHandler(this.CheckPendingOnlyCheckedChanged);
            //
            // TranslateForm
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(880, 673);
            this.Controls.Add(this.checkPendingOnly);
            this.Controls.Add(this.statusStrip1);
            this.Controls.Add(this.btnPopulateTranslations);
            this.Controls.Add(this.panel1);
            this.Controls.Add(this.label1);
            this.Controls.Add(this.btnLoadDestinationTranslation);
            this.Controls.Add(this.btnLoadSourceTranslation);
            this.Controls.Add(this.tbxDestinationTranslationFile);
            this.Controls.Add(this.tbxSourceTranslationFile);
            this.Controls.Add(this.lblDestinationTranslationFile);
            this.Controls.Add(this.lblSourceTranslationFile);
            this.Controls.Add(this.btnSave);
            this.Controls.Add(this.btnQuit);
            this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            this.MinimumSize = new System.Drawing.Size(896, 711);
            this.Name = "TranslateForm";
            this.Text = "YAF Translation 1.20";
            this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.TranslateFormFormClosing);
            this.Load += new System.EventHandler(this.TranslateForm_Load);
            this.panel1.ResumeLayout(false);
            this.statusStrip1.ResumeLayout(false);
            this.statusStrip1.PerformLayout();
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.Button btnQuit;
        private System.Windows.Forms.Button btnSave;
        private System.Windows.Forms.Label lblSourceTranslationFile;
        private System.Windows.Forms.Label lblDestinationTranslationFile;
        private System.Windows.Forms.TextBox tbxSourceTranslationFile;
        private System.Windows.Forms.TextBox tbxDestinationTranslationFile;
        private System.Windows.Forms.Button btnLoadSourceTranslation;
        private System.Windows.Forms.Button btnLoadDestinationTranslation;
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.Panel panel1;
        private System.Windows.Forms.Button btnPopulateTranslations;
        private System.Windows.Forms.StatusStrip statusStrip1;
        private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1;
        private System.Windows.Forms.CheckBox checkPendingOnly;
        private System.Windows.Forms.Button btnAutoTranslate;
        private System.Windows.Forms.ToolStripProgressBar progressBar;
        private SourceGrid.Grid grid1;
    }
}