text:
PEGASUS_USING_PEGASUS;
PEGASUS_USING_STD;

static Boolean verbose;

void test01()
{
    {
        String on1;
        on1 = "//atp:77/root/cimv25:"
              "TennisPlayer.last=\"Rafter\",first=\"Patrick\"";

        String on2;
        on2 = "//atp:77/root/cimv25:"
              "TennisPlayer.first=\"Patrick\",last=\"Rafter\"";

        CIMObjectPath r = on1;
        PEGASUS_TEST_ASSERT(r.toString() != on1);
        PEGASUS_TEST_ASSERT(r.toString() == on2);

        CIMObjectPath r2 = r;
        CIMObjectPath r3 = CIMObjectPath
            ("//atp:77/root/cimv25:"
            "TennisPlayer.first=\"Chris\",last=\"Evert\"");

        if (verbose)
        {
            XmlWriter::printValueReferenceElement(r);
            cout << r.toString() << endl;
        }

        Buffer mofOut;
        MofWriter::appendValueReferenceElement(mofOut, r);
        r.clear();
    }

    {
        CIMObjectPath r1 = CIMObjectPath
            ("MyClass.z=true,y=1234,x=\"Hello World\"");
        CIMObjectPath r2 = CIMObjectPath
            ("myclass.X=\"Hello World\",Z=true,Y=1234");
        CIMObjectPath r3 = CIMObjectPath ("myclass.X=\"Hello\",Z=true,Y=1234");
        // cout << r1.toString() << endl;
        // cout << r2.toString() << endl;
        PEGASUS_TEST_ASSERT(r1 == r2);
        PEGASUS_TEST_ASSERT(r1 != r3);
    }

    // Test case independence and order independence of parameters.
    {
        CIMObjectPath r1 = CIMObjectPath ("X.a=123,b=true");
        CIMObjectPath r2 = CIMObjectPath ("x.B=TRUE,A=123");
        PEGASUS_TEST_ASSERT(r1 == r2);
        PEGASUS_TEST_ASSERT(r1.makeHashCode() == r2.makeHashCode());

        CIMObjectPath r3 = CIMObjectPath ("x.B=TRUE,A=123,c=FALSE");
        PEGASUS_TEST_ASSERT(r1 != r3);
        String keyValue;

        Array<CIMKeyBinding> kbArray;
        {
            Boolean found = false;
            kbArray = r3.getKeyBindings();
            for (Uint32 i = 0; i < kbArray.size(); i++)
            {
                if (verbose)
                {
                    cout << "keyName= " <<  kbArray[i].getName().getString()
                         << " Value= " << kbArray[i].getValue() << endl;
                }
                if ( kbArray[i].getName() == CIMName ("B") )
                {
                    keyValue = kbArray[i].getValue();
                    if(keyValue == "TRUE")
                    found = true;
                }
            }
            if(!found)
            {
                cerr << "Key Binding Test error " << endl;
                exit(1);
            }
            //ATTN: KS 12 May 2002 P3 DEFER - keybinding manipulation. too
            // simplistic.
            // This code demonstrates that it is not easy to manipulate and
            // test keybindings.  Needs better tool both in CIMObjectPath and
            // separate.
        }
    }

    // Test building from component parts of CIM Reference.
    {
        CIMObjectPath r1 ("atp:77", CIMNamespaceName ("root/cimv25"),
            CIMName ("TennisPlayer"));
        CIMObjectPath r2 ("//atp:77/root/cimv25:TennisPlayer.");
        //cout << "r1 " << r1.toString() << endl;
        //cout << "r2 " << r2.toString() << endl;

        PEGASUS_TEST_ASSERT(r1 == r2);
        PEGASUS_TEST_ASSERT(r1.toString() == r2.toString());

    }

    {
        String hostName = "atp:77";
        String nameSpace = "root/cimv2";
        String className = "tennisplayer";

        CIMObjectPath r1;
        r1.setHost(hostName);
        r1.setNameSpace(nameSpace);
        r1.setClassName(className);
        PEGASUS_TEST_ASSERT(r1.getClassName().equal(CIMName ("TENNISPLAYER")));
        PEGASUS_TEST_ASSERT(!r1.getClassName().equal(CIMName ("blob")));

        String newHostName = r1.getHost();
        //cout << "HostName = " << newHostName << endl;

        CIMObjectPath r2 (hostName, nameSpace, className);
        PEGASUS_TEST_ASSERT(r1 == r2);
    }

    // Test cases for the Hostname.  CIMObjectPaths allows the
    // host to include the domain. Eg. xyz.company.com

    // First, try a good hostname
    CIMObjectPath h0("//usoPen-9.ustA-1-a.org:77/root/cimv25:"
        "TennisPlayer.first=\"Chris\",last=\"Evert\"");
    CIMObjectPath h1("//usoPen-9:77/root/cimv25:"
        "TennisPlayer.first=\"Chris\",last=\"Evert\"");
    CIMObjectPath h2("//usoPen-9/root/cimv25:"
        "TennisPlayer.first=\"Chris\",last=\"Evert\"");
    CIMObjectPath h3("//usoPen-9.ustA-1-a.org:0/root/cimv25:"
        "TennisPlayer.first=\"Chris\",last=\"Evert\"");
    CIMObjectPath h4("//usoPen-9.ustA-1-a.org:9876/root/cimv25:"
        "TennisPlayer.first=\"Chris\",last=\"Evert\"");
    CIMObjectPath h5("//usoPen-9.ustA-1-a.org:65535/root/cimv25:"
        "TennisPlayer.first=\"Chris\",last=\"Evert\"");
    CIMObjectPath h6("//usopen-9.usta-1-a.1org:77/root/cimv25:"
        "TennisPlayer.first=\"Chris\",last=\"Evert\"");
    CIMObjectPath h7("//192.168.1.com:77/root/cimv25:"
        "TennisPlayer.first=\"Chris\",last=\"Evert\"");
    CIMObjectPath h8("//192.168.0.org/root/cimv25:"
        "TennisPlayer.first=\"Chris\",last=\"Evert\"");
    CIMObjectPath h9("//192.168.1.80.com:77/root/cimv25:"
        "TennisPlayer.first=\"Chris\",last=\"Evert\"");
    CIMObjectPath h10("//192.168.0.80.org/root/cimv25:"
        "TennisPlayer.first=\"Chris\",last=\"Evert\"");
    CIMObjectPath h11("//192.168.1.80.255.com:77/root/cimv25:"
        "TennisPlayer.first=\"Chris\",last=\"Evert\"");
    CIMObjectPath h12("//192.168.0.80.254.org/root/cimv25:"
        "TennisPlayer.first=\"Chris\",last=\"Evert\"");
    CIMObjectPath h13("//192.168.257.80.com:77/root/cimv25:"
        "TennisPlayer.first=\"Chris\",last=\"Evert\"");
    CIMObjectPath h14("//192.256.0.80.org/root/cimv25:"
        "TennisPlayer.first=\"Chris\",last=\"Evert\"");

    CIMObjectPath h15("//localhost/root/cimv25:"
        "TennisPlayer.first=\"Chris\",last=\"Evert\"");
    CIMObjectPath h16("//ou812/root/cimv25:"
        "TennisPlayer.first=\"Chris\",last=\"Evert\"");
    CIMObjectPath h17("//u812/root/cimv25:"
        "TennisPlayer.first=\"Chris\",last=\"Evert\"");

    // Hostname with '_' character support checks, see bug#2556.
    CIMObjectPath h18("//_atp:9999/_root/_cimv25:_TennisPlayer");
    CIMObjectPath h19("//a_tp/_root/_cimv25:_TennisPlayer");
    CIMObjectPath h20("//atp_:9999/_root/_cimv25:_TennisPlayer");
    CIMObjectPath h21("//atp_-9:9999/_root/_cimv25:_TennisPlayer");
    CIMObjectPath h22(
        "//_a_t_p_-9.ustA-1-a.org:9999/_root/_cimv25:_TennisPlayer");
    CIMObjectPath h23("//_/root/cimv25:_TennisPlayer");
    CIMObjectPath h24("//_______/root/cimv25:_TennisPlayer");

    // try IPAddress as hostname which should be good
    CIMObjectPath h_ip0("//192.168.1.80:77/root/cimv25:"
        "TennisPlayer.first=\"Chris\",last=\"Evert\"");
    CIMObjectPath h_ip1("//192.168.0.255/root/cimv25:"
        "TennisPlayer.first=\"Chris\",last=\"Evert\"");

    // Try IPv6 Addresses.
    CIMObjectPath ip6_1("//[::1]:77/root/cimv25:"
        "TennisPlayer.first=\"Chris\",last=\"Evert\"");

    CIMObjectPath ip6_2("//[::ffff:192.1.2.3]:77/root/cimv25:"
        "TennisPlayer.first=\"Chris\",last=\"Evert\"");

    CIMObjectPath ip6_3("//[fffe:233:321:234d:e45:fad4:78:12]:77/root/cimv25:"
        "TennisPlayer.first=\"Chris\",last=\"Evert\"");

    CIMObjectPath ip6_4("//[fffe::]:77/root/cimv25:"
        "TennisPlayer.first=\"Chris\",last=\"Evert\"");

    Boolean errorDetected = false;

    // Invalid IPV6 Addresses
    try
    { // IPv6 addresses must be enclosed in brackets
        CIMObjectPath ip6_mb("//fffe::12ef:127/root/cimv25:"
            "TennisPlayer.first=\"Chris\",last=\"Evert\"");
    }
    catch (const Exception&)
    {
       errorDetected = true;
    }
    PEGASUS_TEST_ASSERT(errorDetected);

    errorDetected = false;
    try
    { // IPv6 address invalid
        CIMObjectPath ip6_invalid("//[fffe::sd:77]/root/cimv25:"
            "TennisPlayer.first=\"Chris\",last=\"Evert\"");
    }
    catch (const Exception&)
    {
       errorDetected = true;
    }
    PEGASUS_TEST_ASSERT(errorDetected);

    errorDetected = false;
    try
    {
       //Port number out of range.
       CIMObjectPath h_Port("//usoPen-9.ustA-1-a.org:9876543210/root/cimv25:"
           "TennisPlayer.first=\"Chris\",last=\"Evert\"");
    }
    catch (const Exception&)
    {
       errorDetected = true;
    }
    PEGASUS_TEST_ASSERT(errorDetected);

    errorDetected = false;
    try
    {
       //Port number out of range.
       CIMObjectPath h_Port("//usoPen-9.ustA-1-a.org:65536/root/cimv25:"
           "TennisPlayer.first=\"Chris\",last=\"Evert\"");
    }
    catch (const Exception&)
    {
       errorDetected = true;
    }
    PEGASUS_TEST_ASSERT(errorDetected);

    errorDetected = false;
    try
    {
       //Port number out of range.
       CIMObjectPath h_Port("//usoPen-9.ustA-1-a.org:100000/root/cimv25:"
           "TennisPlayer.first=\"Chris\",last=\"Evert\"");
    }
    catch (const Exception&)
    {
       errorDetected = true;
    }
    PEGASUS_TEST_ASSERT(errorDetected);

    errorDetected = false;
    try
    {
        //more than three digits in an octect
        CIMObjectPath h_ErrIp0("//192.1600008.1.80:77/root/cimv25:"
            "TennisPlayer.first=\"Chris\",last=\"Evert\"");
    }
    catch (const Exception&)
    {
        errorDetected = true;
    }
    PEGASUS_TEST_ASSERT(errorDetected);

    errorDetected = false;
    try
    {
        // Octet out of range
        CIMObjectPath op("//192.168.256.80:77/root/cimv25:"
            "TennisPlayer.first=\"Chris\",last=\"Evert\"");
    }
    catch (const Exception&)
    {
        errorDetected = true;
    }
    PEGASUS_TEST_ASSERT(errorDetected);

    errorDetected = false;
    try
    {
        // Missing port
        CIMObjectPath op("//192.168.1.80:/root/cimv25:"
            "TennisPlayer.first=\"Chris\",last=\"Evert\"");
    }
    catch (const Exception&)
    {
        errorDetected = true;
    }
    PEGASUS_TEST_ASSERT(errorDetected);

    errorDetected = false;
    try
    {
        // Too many octets
        CIMObjectPath op("//192.168.1.80.12/root/cimv25:"
            "TennisPlayer.first=\"Chris\",last=\"Evert\"");
    }
    catch (const Exception&)
    {
        errorDetected = true;
    }
    PEGASUS_TEST_ASSERT(errorDetected);

    errorDetected = false;
    try
    {
        // Too few octets
        CIMObjectPath op("//192.168.80:77/root/cimv25:"
            "TennisPlayer.first=\"Chris\",last=\"Evert\"");
    }
    catch (const Exception&)
    {
        errorDetected = true;
    }
    PEGASUS_TEST_ASSERT(errorDetected);

    errorDetected = false;
    try
    {
        // Missing port
        CIMObjectPath op("//usopen-9.usta-1-a.org:/root/cimv25:"
            "TennisPlayer.first=\"Chris\",last=\"Evert\"");
    }
    catch (Exception&)
    {
        errorDetected = true;
    }
    PEGASUS_TEST_ASSERT(errorDetected);

    errorDetected = false;
    try
    {
        // Hostname (IP) without trailing '/' (with port)
        CIMObjectPath op("//192.168.256.80:77");
    }
    catch (const Exception&)
    {
        errorDetected = true;
    }
    PEGASUS_TEST_ASSERT(errorDetected);

    errorDetected = false;
    try
    {
        // Hostname (IP) without trailing '/' (without port)
        CIMObjectPath op("//192.168.256.80");
    }
    catch (const Exception&)
    {
        errorDetected = true;
    }
    PEGASUS_TEST_ASSERT(errorDetected);

    errorDetected = false;
    try
    {
        // Hostname without trailing '/' (with port)
        CIMObjectPath op("//usopen-9.usta-1-a.org:77");
    }
    catch (const Exception&)
    {
        errorDetected = true;
    }
    PEGASUS_TEST_ASSERT(errorDetected);

    errorDetected = false;
    try
    {
        // Hostname without trailing '/' (without port)
        CIMObjectPath op("//usopen-9.usta-1-a.org");
    }
    catch (const Exception&)
    {
        errorDetected = true;
    }
    PEGASUS_TEST_ASSERT(errorDetected);

    errorDetected = false;
    try
    {
        // Invalid first character
        CIMObjectPath op("//+usopen-9.usta-1-a.1org:77/root/cimv25:"
            "TennisPlayer.first=\"Chris\",last=\"Evert\"");
    }
    catch (Exception&)
    {
        errorDetected = true;
    }
    PEGASUS_TEST_ASSERT(errorDetected);

    errorDetected = false;
    try
    {
        // Non-alphanum char (?)
        CIMObjectPath op("//usopen-9.usta?-1-a.org:77/root/cimv25:"
            "TennisPlayer.first=\"Chris\",last=\"Evert\"");
    }
    catch (Exception&)
    {
        errorDetected = true;
    }
    PEGASUS_TEST_ASSERT(errorDetected);

    errorDetected = false;
    try
    {
        // Leading dot
        CIMObjectPath op("//.usopen-9.usta-1-a.org:77/root/cimv25:"
            "TennisPlayer.first=\"Chris\",last=\"Evert\"");
    }
    catch (Exception&)
    {
        errorDetected = true;
    }
    PEGASUS_TEST_ASSERT(errorDetected);

    errorDetected = false;
    try
    {
        // Dot in the wrong spot (before a -)
        CIMObjectPath op("//usopen.-9.usta-1-a.org:77/root/cimv25:"
            "TennisPlayer.first=\"Chris\",last=\"Evert\"");
    }
    catch (Exception&)
    {
        errorDetected = true;
    }
    PEGASUS_TEST_ASSERT(errorDetected);

    errorDetected = false;
    try
    {
        // Two dots in a row
        CIMObjectPath op("//usopen-9.usta-1-a..org:77/root/cimv25:"
            "TennisPlayer.first=\"Chris\",last=\"Evert\"");
    }
    catch (Exception&)
    {
        errorDetected = true;
    }
    PEGASUS_TEST_ASSERT(errorDetected);

    errorDetected = false;
    try
    {
        // Trailing dot
        CIMObjectPath op("//usopen-9.usta-1-a.org.:77/root/cimv25:"
            "TennisPlayer.first=\"Chris\",last=\"Evert\"");
    }
    catch (Exception&)
    {
        errorDetected = true;
    }
    PEGASUS_TEST_ASSERT(errorDetected);
}

void test02()
{
    // test cases with commas in the key value string

    CIMObjectPath testr1 = CIMObjectPath
        ("MyClass.z=true,y=1234,x=\"Hello,World\"");

    CIMObjectPath testr2 = CIMObjectPath
        ("MyClass.z=true,y=1234,x=\"Hello World,\"");

    CIMObjectPath testr3 = CIMObjectPath
        ("MyClass.z=true,y=1234,x=\"Hello,,World\"");

    CIMObjectPath testr4 = CIMObjectPath
        ("//atp:77/root/cimv25:test.last=\"Rafter,Smith.Jones"
         " long_name:any*char=any123%#@!<>?+^\",first=\"Patrick\"");

    // test cases with colon inside keybinding string value

    CIMObjectPath testc1 = CIMObjectPath
        ("MyClass.z=true,y=1234,x=\"Hello:World\"");

    Boolean colonException = false;
    try
    {
        CIMObjectPath testc2 = CIMObjectPath
            ("MyNamespace.ns:MyClass.z=true,y=1234,x=\"Hello:World\"");
    }
    catch (Exception&)
    {
        colonException = true;
    }
    PEGASUS_TEST_ASSERT(colonException);

    // test error cases

    Boolean errorDetected = false;
    try
    {
        CIMObjectPath testerr1 = CIMObjectPath
           ("myclass.X=\"Hello World\"Z=trueY=1234");
    }
    catch (Exception&)
    {
        errorDetected = true;
    }
    PEGASUS_TEST_ASSERT(errorDetected);

    errorDetected = false;
    try
    {
        CIMObjectPath testerr2 = CIMObjectPath ("myclass.XYZ");
    }
    catch (Exception&)
    {
        errorDetected = true;
    }
    PEGASUS_TEST_ASSERT(errorDetected);

    errorDetected = false;
    try
    {
        CIMObjectPath testerr3 = CIMObjectPath
            ("MyClass.z=true,y=1234abc,x=\"Hello World\"");
    }
    catch (Exception&)
    {
        errorDetected = true;
    }
    PEGASUS_TEST_ASSERT(errorDetected);

    errorDetected = false;
    try
    {
        CIMObjectPath testerr4 = CIMObjectPath
            ("MyClass.z=nottrue,y=1234,x=\"Hello World\"");
    }
    catch (Exception&)
    {
        errorDetected = true;
    }
    PEGASUS_TEST_ASSERT(errorDetected);
}

// Test CIMKeyBinding constructor (CIMValue variety) and equal(CIMValue) method
void test03()
{
    CIMKeyBinding kb0("test0", Real32(3.14159));
    PEGASUS_TEST_ASSERT(kb0.equal(Real32(3.14159)));
    PEGASUS_TEST_ASSERT(!kb0.equal(Real32(3.141593)));

    CIMKeyBinding kb1("test1", String("3.14159"), CIMKeyBinding::NUMERIC);
    PEGASUS_TEST_ASSERT(kb1.equal(Real32(3.14159)));
    PEGASUS_TEST_ASSERT(!kb1.equal(String("3.14159")));

    CIMKeyBinding kb2("test2", Uint32(1000));
    PEGASUS_TEST_ASSERT(kb2.equal(Uint32(1000)));
    PEGASUS_TEST_ASSERT(!kb2.equal(Uint32(1001)));
    PEGASUS_TEST_ASSERT(kb2.getValue() == "1000");

    CIMKeyBinding kb3("test3", Char16('X'));
    PEGASUS_TEST_ASSERT(kb3.equal(Char16('X')));
    PEGASUS_TEST_ASSERT(!kb3.equal(Char16('Y')));
    PEGASUS_TEST_ASSERT(kb3.getValue() == "X");

    CIMKeyBinding kb4("test4", CIMDateTime("19991224120000.000000+360"));
    PEGASUS_TEST_ASSERT(kb4.equal(CIMDateTime("19991224120000.000000+360")));
    PEGASUS_TEST_ASSERT(!kb4.equal(CIMDateTime("19991225120000.000000+360")));
    PEGASUS_TEST_ASSERT(kb4.getValue() == "19991224120000.000000+360");
    kb4.setValue("0");
    PEGASUS_TEST_ASSERT(!kb4.equal(CIMDateTime("19991224120000.000000+360")));

    CIMKeyBinding kb5("test5", String("StringTest"));
    PEGASUS_TEST_ASSERT(kb5.equal(String("StringTest")));
    PEGASUS_TEST_ASSERT(!kb5.equal(String("StringTest1")));
    PEGASUS_TEST_ASSERT(kb5.getValue() == "StringTest");

    CIMKeyBinding kb6("test6", Boolean(true));
    PEGASUS_TEST_ASSERT(kb6.equal(Boolean(true)));
    PEGASUS_TEST_ASSERT(!kb6.equal(Boolean(false)));
    PEGASUS_TEST_ASSERT(kb6.getValue() == "TRUE");
    kb6.setValue("true1");
    PEGASUS_TEST_ASSERT(!kb6.equal(Boolean(true)));

    CIMKeyBinding kb7("test7",
        CIMObjectPath("//atp:77/root/cimv25:TennisPlayer."
            "last=\"Rafter\",first=\"Patrick\""));

    String path = "//atp:77/root/cimv25:TennisPlayer."
                  "last=\"Rafter\",first=\"Patrick\"";
    PEGASUS_TEST_ASSERT(kb7.equal(CIMObjectPath(path)));

    path = "//atp:77/root/cimv25:TennisPlayer."
           "FIRST=\"Patrick\",LAST=\"Rafter\"";
    PEGASUS_TEST_ASSERT(kb7.equal(CIMObjectPath(path)));

    path = "//atp:77/root/cimv25:TennisPlayer.last=\"Rafter\"";
    PEGASUS_TEST_ASSERT(!kb7.equal(CIMObjectPath(path)));

    Boolean exceptionFlag = false;
    try
    {
        CIMKeyBinding kb8("test8", Array<Uint32>());
    }
    catch (TypeMismatchException&)
    {
        exceptionFlag = true;
    }
    PEGASUS_TEST_ASSERT(exceptionFlag);

    CIMKeyBinding kb9("test9", String("1000"), CIMKeyBinding::STRING);
    PEGASUS_TEST_ASSERT(!kb9.equal(Uint32(1000)));

    CIMKeyBinding kb10("test10", String("100"), CIMKeyBinding::NUMERIC);
    PEGASUS_TEST_ASSERT(kb10.equal(Uint64(100)));
    PEGASUS_TEST_ASSERT(kb10.equal(Uint32(100)));
    PEGASUS_TEST_ASSERT(kb10.equal(Uint16(100)));
    PEGASUS_TEST_ASSERT(kb10.equal(Uint8(100)));
    PEGASUS_TEST_ASSERT(kb10.equal(Sint64(100)));
    PEGASUS_TEST_ASSERT(kb10.equal(Sint32(100)));
    PEGASUS_TEST_ASSERT(kb10.equal(Sint16(100)));
    PEGASUS_TEST_ASSERT(kb10.equal(Sint8(100)));
    PEGASUS_TEST_ASSERT(!kb10.equal(String("100")));

    CIMKeyBinding kb11("test11", String("+100"), CIMKeyBinding::NUMERIC);
    // Unsigned ints may not start with "+"
    PEGASUS_TEST_ASSERT(!kb11.equal(Uint64(100)));
    PEGASUS_TEST_ASSERT(!kb11.equal(Uint32(100)));
    PEGASUS_TEST_ASSERT(!kb11.equal(Uint16(100)));
    PEGASUS_TEST_ASSERT(!kb11.equal(Uint8(100)));
    PEGASUS_TEST_ASSERT(kb11.equal(Sint64(100)));
    PEGASUS_TEST_ASSERT(kb11.equal(Sint32(100)));
    PEGASUS_TEST_ASSERT(kb11.equal(Sint16(100)));
    PEGASUS_TEST_ASSERT(kb11.equal(Sint8(100)));
    PEGASUS_TEST_ASSERT(!kb11.equal(String("100")));
}

//
//  Test identical() function with keys that are references
//
void test04()
{
    //
    // Create classes A and B referenced classes, C - Association
    //
    CIMClass classA (CIMName ("A"), CIMName ());
    CIMProperty propertyX ("x", String ());
    propertyX.addQualifier (CIMQualifier (CIMName ("Key"), true));
    CIMProperty propertyY ("y", String ());
    propertyY.addQualifier (CIMQualifier (CIMName ("Key"), true));
    CIMProperty propertyZ ("z", String ());
    propertyZ.addQualifier (CIMQualifier (CIMName ("Key"), true));
    classA.addProperty (propertyX);
    classA.addProperty (propertyY);
    classA.addProperty (propertyZ);

    CIMClass classB ("B");
    CIMProperty propertyQ ("q", String ());
    propertyQ.addQualifier (CIMQualifier (CIMName ("Key"), true));
    CIMProperty propertyR ("r", String ());
    propertyR.addQualifier (CIMQualifier (CIMName ("Key"), true));
    CIMProperty propertyS ("s", String ());
    propertyS.addQualifier (CIMQualifier (CIMName ("Key"), true));
    classB.addProperty (propertyQ);
    classB.addProperty (propertyR);
    classB.addProperty (propertyS);

    CIMClass classC ("C");
    CIMProperty propertyA ("a", CIMValue ());
    propertyA.addQualifier (CIMQualifier (CIMName ("Key"), true));
    CIMProperty propertyB ("b", CIMValue ());
    propertyB.addQualifier (CIMQualifier (CIMName ("Key"), true));
    classC.addProperty (propertyA);
    classC.addProperty (propertyB);

    //
    //  Create instances of each classa
    //
    CIMInstance instanceA (CIMName ("A"));
    instanceA.addProperty (CIMProperty (CIMName ("x"), String ("rose")));
    instanceA.addProperty (CIMProperty (CIMName ("y"), String ("lavender")));
    instanceA.addProperty (CIMProperty (CIMName ("z"), String ("rosemary")));
    CIMObjectPath aPath = instanceA.buildPath (classA);
    CIMObjectPath aPath2 ("A.y=\"lavender\",x=\"rose\",z=\"rosemary\"");
    PEGASUS_TEST_ASSERT (aPath.identical (aPath2));

    CIMInstance instanceB (CIMName ("B"));
    instanceB.addProperty (CIMProperty (CIMName ("q"),
        String ("pelargonium")));
    instanceB.addProperty (CIMProperty (CIMName ("r"), String ("thyme")));
    instanceB.addProperty (CIMProperty (CIMName ("s"), String ("sage")));

    // Test to assure that the buildpath function works.
    CIMObjectPath bPath = instanceB.buildPath (classB);
    CIMObjectPath bPath2 ("B.s=\"sage\",q=\"pelargonium\",r=\"thyme\"");
    PEGASUS_TEST_ASSERT (bPath.identical (bPath2));

    // Build instance of C and build path from buildPath function.
    CIMInstance instanceC (CIMName ("C"));
    instanceC.addProperty (CIMProperty (CIMName ("a"), aPath, 0,
        CIMName ("A")));
    instanceC.addProperty (CIMProperty (CIMName ("b"), bPath, 0,
        CIMName ("B")));
    CIMObjectPath cPath = instanceC.buildPath (classC);

    // Build CIMObjectPath from keybindings.
    Array <CIMKeyBinding> keyBindings;
    CIMKeyBinding aBinding ("a", "A.y=\"lavender\",x=\"rose\",z=\"rosemary\"",
        CIMKeyBinding::REFERENCE);
    CIMKeyBinding bBinding ("b", "B.s=\"sage\",q=\"pelargonium\",r=\"thyme\"",
        CIMKeyBinding::REFERENCE);
    keyBindings.append (aBinding);
    keyBindings.append (bBinding);

    CIMObjectPath cPath2 ("", CIMNamespaceName (),
        cPath.getClassName (), keyBindings);

    // Assert that the CIMObjectPaths for C from build path and direct
    // from keybindings are equal.
    PEGASUS_TEST_ASSERT (cPath.identical (cPath2));

    // ATTN: KS 25 Feb 2003 P3 - Think we can extend these tests
    // since this is creation of classes and
    // instnaces for associations and referenced classes.
}

// Test handling of escape characters
void test05()
{
    {
        // Test '\' and '"' characters in a key value
        // This represents MyClass.key1="\\\"\"\\",key2="\"\"\"\"\\\\\\\\"
        String s1 = "MyClass.key1=\"\\\\\\\"\\\"\\\\\","
                "key2=\"\\\"\\\"\\\"\\\"\\\\\\\\\\\\\\\\\"";
        CIMObjectPath r1 = s1;
        PEGASUS_TEST_ASSERT(r1.toString() == s1);
    }

    // Catch invalid escape sequences in a key value
    Boolean errorDetected;

    // Invalid trailing backslash
    errorDetected = false;
    try
    {
        CIMObjectPath r1("MyClass.key1=\"\\\"");
    }
    catch (const MalformedObjectNameException&)
    {
       errorDetected = true;
    }
    PEGASUS_TEST_ASSERT(errorDetected);

    // Invalid "\n" sequence
    errorDetected = false;
    try
    {
        CIMObjectPath r1("MyClass.key1=\"\\n\"");
    }
    catch (const MalformedObjectNameException&)
    {
       errorDetected = true;
    }
    PEGASUS_TEST_ASSERT(errorDetected);

    // Invalid hex sequence
    errorDetected = false;
    try
    {
        CIMObjectPath r1("MyClass.key1=\"\\x000A\"");
    }
    catch (const MalformedObjectNameException&)
    {
       errorDetected = true;
    }
    PEGASUS_TEST_ASSERT(errorDetected);
}

// Test CIMKeyBinding operator==
void test06()
{
    CIMKeyBinding kb1;
    CIMKeyBinding kb2;

    // Key bindings of different types are not equal
    kb1 = CIMKeyBinding("a", "true", CIMKeyBinding::BOOLEAN);
    kb2 = CIMKeyBinding("a", "true", CIMKeyBinding::STRING);
    PEGASUS_TEST_ASSERT(!(kb1 == kb2));

    // Key bindings with different names are not equal
    kb1 = CIMKeyBinding("a", "true", CIMKeyBinding::BOOLEAN);
    kb2 = CIMKeyBinding("b", "true", CIMKeyBinding::BOOLEAN);
    PEGASUS_TEST_ASSERT(!(kb1 == kb2));

    // Key bindings names are not case sensitive
    kb1 = CIMKeyBinding("a", "true", CIMKeyBinding::BOOLEAN);
    kb2 = CIMKeyBinding("A", "true", CIMKeyBinding::BOOLEAN);
    PEGASUS_TEST_ASSERT(kb1 == kb2);

    // Boolean key bindings are not case sensitive
    kb1 = CIMKeyBinding("a", "true", CIMKeyBinding::BOOLEAN);
    kb2 = CIMKeyBinding("a", "TrUe", CIMKeyBinding::BOOLEAN);
    PEGASUS_TEST_ASSERT(kb1 == kb2);

    // Boolean key bindings are not equal if they differ other than in case
    kb1 = CIMKeyBinding("a", "true", CIMKeyBinding::BOOLEAN);
    kb2 = CIMKeyBinding("a", "truee", CIMKeyBinding::BOOLEAN);
    PEGASUS_TEST_ASSERT(!(kb1 == kb2));

    // Numeric key binding comparisons are done based on integer values
    kb1 = CIMKeyBinding("a", "14", CIMKeyBinding::NUMERIC);
    kb2 = CIMKeyBinding("a", "14", CIMKeyBinding::NUMERIC);
    PEGASUS_TEST_ASSERT(kb1 == kb2);

    kb1 = CIMKeyBinding("a", "14", CIMKeyBinding::NUMERIC);
    kb2 = CIMKeyBinding("a", "140", CIMKeyBinding::NUMERIC);
    PEGASUS_TEST_ASSERT(!(kb1 == kb2));

    kb1 = CIMKeyBinding("a", "+14", CIMKeyBinding::NUMERIC);
    kb2 = CIMKeyBinding("a", "14", CIMKeyBinding::NUMERIC);
    PEGASUS_TEST_ASSERT(kb1 == kb2);

    kb1 = CIMKeyBinding("a", "0", CIMKeyBinding::NUMERIC);
    kb2 = CIMKeyBinding("a", "-0", CIMKeyBinding::NUMERIC);
    PEGASUS_TEST_ASSERT(kb1 == kb2);

    // Hexadecimal format is also understood
    kb1 = CIMKeyBinding("a", "14", CIMKeyBinding::NUMERIC);
    kb2 = CIMKeyBinding("a", "0x0E", CIMKeyBinding::NUMERIC);
    PEGASUS_TEST_ASSERT(kb1 == kb2);

    kb1 = CIMKeyBinding("a", "0x0E", CIMKeyBinding::NUMERIC);
    kb2 = CIMKeyBinding("a", "0x0e", CIMKeyBinding::NUMERIC);
    PEGASUS_TEST_ASSERT(kb1 == kb2);

    // Numeric key bindings are not equal if they differ other than in case
    kb1 = CIMKeyBinding("a", "true", CIMKeyBinding::NUMERIC);
    kb2 = CIMKeyBinding("a", "truee", CIMKeyBinding::NUMERIC);
    PEGASUS_TEST_ASSERT(!(kb1 == kb2));

    // String comparison is used if numeric key binding is not a valid integer
    kb1 = CIMKeyBinding("a", "14a", CIMKeyBinding::NUMERIC);
    kb2 = CIMKeyBinding("a", "14a", CIMKeyBinding::NUMERIC);
    PEGASUS_TEST_ASSERT(kb1 == kb2);

    kb1 = CIMKeyBinding("a", "14", CIMKeyBinding::NUMERIC);
    kb2 = CIMKeyBinding("a", "14a", CIMKeyBinding::NUMERIC);
    PEGASUS_TEST_ASSERT(!(kb1 == kb2));

    // String key bindings are compared using a simple string comparison
    kb1 = CIMKeyBinding("a", "My String", CIMKeyBinding::STRING);
    kb2 = CIMKeyBinding("a", "My String", CIMKeyBinding::STRING);
    PEGASUS_TEST_ASSERT(kb1 == kb2);

    kb1 = CIMKeyBinding("a", "My String", CIMKeyBinding::STRING);
    kb2 = CIMKeyBinding("a", "my string", CIMKeyBinding::STRING);
    PEGASUS_TEST_ASSERT(!(kb1 == kb2));

    // Reference key bindings are compared as CIMObjectPath objects
    kb1 = CIMKeyBinding("a", "aClass.key1=true,key2=256",
                        CIMKeyBinding::REFERENCE);
    kb2 = CIMKeyBinding("a", "AClass.Key2=0x100,Key1=TRUE",
                        CIMKeyBinding::REFERENCE);
    PEGASUS_TEST_ASSERT(kb1 == kb2);

    kb1 = CIMKeyBinding("a", "aClass.key1=\"true\"",
                        CIMKeyBinding::REFERENCE);
    kb2 = CIMKeyBinding("a", "AClass.Key1=\"TRUE\"",
                        CIMKeyBinding::REFERENCE);
    PEGASUS_TEST_ASSERT(!(kb1 == kb2));

    kb1 = CIMKeyBinding("a", "a.ref=\"aClass.key1=true,key2=256\"",
                        CIMKeyBinding::REFERENCE);
    kb2 = CIMKeyBinding("a", "a.ref=\"AClass.Key2=0x100,Key1=TRUE\"",
                        CIMKeyBinding::REFERENCE);
    PEGASUS_TEST_ASSERT(kb1 == kb2);

    kb1 = CIMKeyBinding("a", "//myHost/ns1/ns2:aClass.key1=1",
                        CIMKeyBinding::REFERENCE);
    kb2 = CIMKeyBinding("a", "//MyHost/NS1/NS2:AClass.key1=0x1",
                        CIMKeyBinding::REFERENCE);
    PEGASUS_TEST_ASSERT(kb1 == kb2);

    kb1 = CIMKeyBinding("a", "//myHost/ns1/ns2:aClass.key1=1",
                        CIMKeyBinding::REFERENCE);
    kb2 = CIMKeyBinding("a", "ns1/ns2:aClass.key1=1",
                        CIMKeyBinding::REFERENCE);
    PEGASUS_TEST_ASSERT(!(kb1 == kb2));

    kb1 = CIMKeyBinding("a", "ns1/ns2:aClass.key1=1",
                        CIMKeyBinding::REFERENCE);
    kb2 = CIMKeyBinding("a", "aClass.key1=1",
                        CIMKeyBinding::REFERENCE);
    PEGASUS_TEST_ASSERT(!(kb1 == kb2));

    kb1 = CIMKeyBinding("a", "aClass.key1=1,key2=2",
                        CIMKeyBinding::REFERENCE);
    kb2 = CIMKeyBinding("a", "aClass.key1=1",
                        CIMKeyBinding::REFERENCE);
    PEGASUS_TEST_ASSERT(!(kb1 == kb2));

    // String comparison is used if numeric key binding is not a valid integer
    kb1 = CIMKeyBinding("a", "Bad Reference", CIMKeyBinding::REFERENCE);
    kb2 = CIMKeyBinding("a", "Bad Reference", CIMKeyBinding::REFERENCE);
    PEGASUS_TEST_ASSERT(kb1 == kb2);

    kb1 = CIMKeyBinding("a", "Bad Reference", CIMKeyBinding::REFERENCE);
    kb2 = CIMKeyBinding("a", "bad reference", CIMKeyBinding::REFERENCE);
    PEGASUS_TEST_ASSERT(!(kb1 == kb2));
}

// Test hash code generation
void test07()
{
    CIMObjectPath op1;
    CIMObjectPath op2;

    // Hostname case does not affect the hash code
    op1 = CIMObjectPath("//myhost/ns1/ns2:aClass.key1=1");
    op2 = CIMObjectPath("//MyHost/ns1/ns2:aClass.key1=1");
    PEGASUS_TEST_ASSERT(op1.makeHashCode() == op2.makeHashCode());

    // Namespace case does not affect the hash code
    op1 = CIMObjectPath("//myhost/ns1/ns2:aClass.key1=1");
    op2 = CIMObjectPath("//myhost/NS1/Ns2:aClass.key1=1");
    PEGASUS_TEST_ASSERT(op1.makeHashCode() == op2.makeHashCode());

    // Class name case does not affect the hash code
    op1 = CIMObjectPath("//myhost/ns1/ns2:aClass.key1=1");
    op2 = CIMObjectPath("//myhost/ns1/ns2:ACLASS.key1=1");
    PEGASUS_TEST_ASSERT(op1.makeHashCode() == op2.makeHashCode());

    //
    // Equivalent key bindings generate the same hash code
    //
    Array<CIMKeyBinding> kba1;
    Array<CIMKeyBinding> kba2;

    // Key name case does not affect the hash code
    kba1.clear();
    kba2.clear();
    kba1.append(CIMKeyBinding("key1", "1", CIMKeyBinding::NUMERIC));
    kba2.append(CIMKeyBinding("KeY1", "1", CIMKeyBinding::NUMERIC));
    op1.set("myhost", CIMNamespaceName("ns1/ns2"), CIMName("aClass"), kba1);
    op2.set("myhost", CIMNamespaceName("ns1/ns2"), CIMName("aClass"), kba2);
    PEGASUS_TEST_ASSERT(op1.makeHashCode() == op2.makeHashCode());

    // Key binding order does not affect the hash code
    kba1.clear();
    kba2.clear();
    kba1.append(CIMKeyBinding("key1", "1", CIMKeyBinding::NUMERIC));
    kba1.append(CIMKeyBinding("key2", "2", CIMKeyBinding::NUMERIC));
    kba2.append(CIMKeyBinding("key2", "2", CIMKeyBinding::NUMERIC));
    kba2.append(CIMKeyBinding("key1", "1", CIMKeyBinding::NUMERIC));
    op1.set("myhost", CIMNamespaceName("ns1/ns2"), CIMName("aClass"), kba1);
    op2.set("myhost", CIMNamespaceName("ns1/ns2"), CIMName("aClass"), kba2);
    PEGASUS_TEST_ASSERT(op1.makeHashCode() == op2.makeHashCode());

    // Boolean key value case does not affect the hash code
    kba1.clear();
    kba2.clear();
    kba1.append(CIMKeyBinding("key1", "true", CIMKeyBinding::BOOLEAN));
    kba2.append(CIMKeyBinding("KeY1", "True", CIMKeyBinding::BOOLEAN));
    op1.set("myhost", CIMNamespaceName("ns1/ns2"), CIMName("aClass"), kba1);
    op2.set("myhost", CIMNamespaceName("ns1/ns2"), CIMName("aClass"), kba2);
    PEGASUS_TEST_ASSERT(op1.makeHashCode() == op2.makeHashCode());

    // Equivalent numeric key value forms do not affect the hash code
    kba1.clear();
    kba2.clear();
    kba1.append(CIMKeyBinding("key1", "1023", CIMKeyBinding::NUMERIC));
    kba2.append(CIMKeyBinding("KeY1", "0x3FF", CIMKeyBinding::NUMERIC));
    op1.set("myhost", CIMNamespaceName("ns1/ns2"), CIMName("aClass"), kba1);
    op2.set("myhost", CIMNamespaceName("ns1/ns2"), CIMName("aClass"), kba2);
    PEGASUS_TEST_ASSERT(op1.makeHashCode() == op2.makeHashCode());

    kba1.clear();
    kba2.clear();
    kba1.append(CIMKeyBinding("key1", "0", CIMKeyBinding::NUMERIC));
    kba2.append(CIMKeyBinding("KeY1", "-0", CIMKeyBinding::NUMERIC));
    op1.set("myhost", CIMNamespaceName("ns1/ns2"), CIMName("aClass"), kba1);
    op2.set("myhost", CIMNamespaceName("ns1/ns2"), CIMName("aClass"), kba2);
    PEGASUS_TEST_ASSERT(op1.makeHashCode() == op2.makeHashCode());

    // Invalid numeric key value forms generate a consistent hash code
    kba1.clear();
    kba2.clear();
    kba1.append(CIMKeyBinding("key1", "abc", CIMKeyBinding::NUMERIC));
    kba2.append(CIMKeyBinding("KeY1", "abc", CIMKeyBinding::NUMERIC));
    op1.set("myhost", CIMNamespaceName("ns1/ns2"), CIMName("aClass"), kba1);
    op2.set("myhost", CIMNamespaceName("ns1/ns2"), CIMName("aClass"), kba2);
    PEGASUS_TEST_ASSERT(op1.makeHashCode() == op2.makeHashCode());

    // Equivalent reference key value forms do not affect the hash code
    kba1.clear();
    kba2.clear();
    kba1.append(CIMKeyBinding("key1", "aClass.key1=true,key2=256",
                CIMKeyBinding::REFERENCE));
    kba2.append(CIMKeyBinding("KeY1", "AClass.Key2=0x100,Key1=TRUE",
                CIMKeyBinding::REFERENCE));
    op1.set("myhost", CIMNamespaceName("ns1/ns2"), CIMName("aClass"), kba1);
    op2.set("myhost", CIMNamespaceName("ns1/ns2"), CIMName("aClass"), kba2);
    PEGASUS_TEST_ASSERT(op1.makeHashCode() == op2.makeHashCode());

    kba1.clear();
    kba2.clear();
    kba1.append(CIMKeyBinding("key2", "a.ref=\"aClass.key1=true,key2=256\"",
                CIMKeyBinding::REFERENCE));
    kba2.append(CIMKeyBinding("Key2", "A.ref=\"AClass.Key2=0x100,Key1=TRUE\"",
                CIMKeyBinding::REFERENCE));
    op1.set("myhost", CIMNamespaceName("ns1/ns2"), CIMName("aClass"), kba1);
    op2.set("myhost", CIMNamespaceName("ns1/ns2"), CIMName("aClass"), kba2);
    PEGASUS_TEST_ASSERT(op1.makeHashCode() == op2.makeHashCode());

    kba1.clear();
    kba2.clear();
    kba1.append(CIMKeyBinding("key", "//myHost/ns1/ns2:aClass.key1=1",
                CIMKeyBinding::REFERENCE));
    kba2.append(CIMKeyBinding("Key", "//MyHost/NS1/NS2:AClass.key1=0x1",
                CIMKeyBinding::REFERENCE));
    op1.set("myhost", CIMNamespaceName("ns1/ns2"), CIMName("aClass"), kba1);
    op2.set("myhost", CIMNamespaceName("ns1/ns2"), CIMName("aClass"), kba2);
    PEGASUS_TEST_ASSERT(op1.makeHashCode() == op2.makeHashCode());

    // Kitchen sink
    kba1.clear();
    kba2.clear();
    kba1.append(CIMKeyBinding("bck", "true", CIMKeyBinding::BOOLEAN));
    kba1.append(CIMKeyBinding("rk2", "a.ref=\"aClass.key1=true,key2=256\"",
                CIMKeyBinding::REFERENCE));
    kba1.append(CIMKeyBinding("neK1", "1023", CIMKeyBinding::NUMERIC));
    kba1.append(CIMKeyBinding("SEk", "abc", CIMKeyBinding::STRING));
    kba1.append(CIMKeyBinding("rk3", "//myHost/ns1/ns2:aClass.key1=1",
                CIMKeyBinding::REFERENCE));
    kba1.append(CIMKeyBinding("NEk2", "0", CIMKeyBinding::NUMERIC));
    kba1.append(CIMKeyBinding("NiK", "abc", CIMKeyBinding::NUMERIC));
    kba1.append(CIMKeyBinding("rK1", "aClass.key1=true,key2=256",
                CIMKeyBinding::REFERENCE));
    kba2.append(CIMKeyBinding("rk1", "AClass.Key2=0x100,Key1=TRUE",
                CIMKeyBinding::REFERENCE));
    kba2.append(CIMKeyBinding("nek2", "-0", CIMKeyBinding::NUMERIC));
    kba2.append(CIMKeyBinding("BcK", "True", CIMKeyBinding::BOOLEAN));
    kba2.append(CIMKeyBinding("rk2", "A.ref=\"AClass.Key2=0x100,Key1=TRUE\"",
                CIMKeyBinding::REFERENCE));
    kba2.append(CIMKeyBinding("Nek1", "0x3FF", CIMKeyBinding::NUMERIC));
    kba2.append(CIMKeyBinding("Nik", "abc", CIMKeyBinding::NUMERIC));
    kba2.append(CIMKeyBinding("Sek", "abc", CIMKeyBinding::STRING));
    kba2.append(CIMKeyBinding("rk3", "//MyHost/NS1/NS2:AClass.key1=0x1",
                CIMKeyBinding::REFERENCE));
    op1.set("myhost", CIMNamespaceName("ns1/ns2"), CIMName("aClass"), kba1);
    op2.set("MyHOST", CIMNamespaceName("Ns1/NS2"), CIMName("Aclass"), kba2);
    PEGASUS_TEST_ASSERT(op1.makeHashCode() == op2.makeHashCode());
}

// Test non-ASCII character handling
void test08()
{
    CIMObjectPath op = CIMObjectPath("//myHost/ns1/ns2:aClass.key1=1");
    Boolean errorDetected;

    // Test non-ASCII first character of hostname
    errorDetected = false;
    try
    {
        String hostname = "123.123.123.123";
        hostname[0] = 0x131;
        op.setHost(hostname);
    }
    catch (const MalformedObjectNameException&)
    {
        errorDetected = true;
    }
    PEGASUS_TEST_ASSERT(errorDetected);

    // Test non-ASCII non-first character of IP address octet
    errorDetected = false;
    try
    {
        String hostname = "123.123.123.123";
        hostname[1] = 0x132;
        op.setHost(hostname);
    }
    catch (const MalformedObjectNameException&)
    {
        errorDetected = true;
    }
    PEGASUS_TEST_ASSERT(errorDetected);

    // Test non-ASCII first character of IP address octet
    errorDetected = false;
    try
    {
        String hostname = "123.123.123.123";
        hostname[4] = 0x131;
        op.setHost(hostname);
    }
    catch (const MalformedObjectNameException&)
    {
        errorDetected = true;
    }
    PEGASUS_TEST_ASSERT(errorDetected);

    // Test non-ASCII first character of hostname segment
    errorDetected = false;
    try
    {
        String hostname = "myhost.123.com";
        hostname[7] = 0x131;
        op.setHost(hostname);
    }
    catch (const MalformedObjectNameException&)
    {
        errorDetected = true;
    }
    PEGASUS_TEST_ASSERT(errorDetected);

    // Test non-ASCII non-first character of hostname segment
    errorDetected = false;
    try
    {
        String hostname = "myhost.123.com";
        hostname[8] = 0x132;
        op.setHost(hostname);
    }
    catch (const MalformedObjectNameException&)
    {
        errorDetected = true;
    }
    PEGASUS_TEST_ASSERT(errorDetected);

    // Test non-ASCII first character of port number
    errorDetected = false;
    try
    {
        String hostname = "myhost.123.com:1234";
        hostname[15] = 0x131;
        op.setHost(hostname);
    }
    catch (const MalformedObjectNameException&)
    {
        errorDetected = true;
    }
    PEGASUS_TEST_ASSERT(errorDetected);

    // Test non-ASCII non-first character of port number
    errorDetected = false;
    try
    {
        String hostname = "myhost.123.com:1234";
        hostname[18] = 0x134;
        op.setHost(hostname);
    }
    catch (const MalformedObjectNameException&)
    {
        errorDetected = true;
    }
    PEGASUS_TEST_ASSERT(errorDetected);
}

int main(int argc, char** argv)
{
    verbose = getenv("PEGASUS_TEST_VERBOSE") ? true : false;

    try
    {
        test01();
        test02();
        test03();
        test04();
        test05();
        test06();
        test07();
        test08();

        cout << argv[0] << " +++++ passed all tests" << endl;
    }
    catch (Exception& e)
    {
        cerr << argv[0] << " Exception " << e.getMessage() << endl;
        exit(1);
    }
    return 0;
}


text:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
  <solid android:color="#ffffff" />
  <stroke android:width="1dp" android:color="#dddddd" />
  <corners android:radius="1dp" />
</shape>

redpajama_set_name: RedPajamaGithub


text:
package com.buschmais.xo.neo4j.test.implementedby.composite;

import com.buschmais.xo.api.proxy.ProxyMethod;
import org.neo4j.graphdb.PropertyContainer;

public class SetMethod implements ProxyMethod<PropertyContainer> {

    @Override
    public Object invoke(PropertyContainer propertyContainer, Object instance, Object[] args) {
        String value = (String) args[0];
        propertyContainer.setProperty("test", "set_" + value);
        return null;
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2021 The Chromium Authors
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->

<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:focusable="false" >

    <ImageView
        android:id="@+id/header_image"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingTop="24dp"
        android:paddingBottom="24dp"
        android:background="@color/signin_header_animation_background"
        android:contentDescription="@string/adaptive_toolbar_edit_shortcut"
        android:scaleType="center"
        app:srcCompat="@drawable/adaptive_toolbar_preference_header"/>

</RelativeLayout>


text:
https://en.wikipedia.org/wiki/Data_wrangling
https://en.wikipedia.org/wiki/Extract,_transform,_load
https://spring.io/docs


text:
package com.comcast.xfinity.sirius.api

object SiriusConfiguration {

  /**
   * Host to bind akka to (string)
   *
   * Takes precedence over all other akka configuration for host
   */
  final val HOST = "sirius.akka.host"

  /**
   * Port to bind akka to (int)
   *
   * Takes precedence over all other akka configuration for port
   */
  final val PORT = "sirius.akka.port"

  /**
   * Flag (boolean) to enable or disable SSL encryption support for akka
   * If enabled all akka communications will be done over SSL providing
   * the key store and trust store are configured correctly
   */
  final val ENABLE_SSL = "sirius.akka.ssl"

  /**
   * Implementation of random number generator to use with SSL security. Defaults to
   * the no-arg constructor of [[java.security.SecureRandom]].
   *
   * Possible values include AES128CounterSecureRNG, AES256CounterSecureRNG, AES128CounterInetRNG,
   * AES256CounterInetRNG, SHA1PRNG, NativePRNG. See [[akka.remote.transport.netty.NettySSLSupport]] for
   * more details.
   */
  final val SSL_RANDOM_NUMBER_GENERATOR = "sirius.akka.ssl.rng"

  /**
   * Support for akka over SSL
   * This is the configurable Java key store location and is used by the server connection
   */
  final val KEY_STORE_LOCATION = "sirius.akka.ssl.key-store.location"

  /**
   * Support for akka over SSL
   * This is the configurable Java key store password used for decrypting the key store
   */
  final val KEY_STORE_PASSWORD = "sirius.akka.ssl.key-store.password"

  /**
   * Support for akka over SSL
   * This is configurable Java key password used for decrypting the key
   */
  final val KEY_PASSWORD = "sirius.akka.ssl.key.password"

  /**
    * Support for akka over SSL
    * This is the configurable Java trust store location and is used by the client connection
    */
   final val TRUST_STORE_LOCATION = "sirius.akka.ssl.trust-store.location"

  /**
   * Support for akka over SSL
   * Configurable Java trust store password used to decrypt the trust store
   */
  final val TRUST_STORE_PASSWORD = "sirius.akka.ssl.trust-store.password"

  /**
   *  AkkaExternalAddressResolver
   */
  final val AKKA_EXTERNAL_ADDRESS_RESOLVER = "sirius.akka.external-address-resolver"

  /**
   * External akka ActorSystem configuration. It this location exists
   * on the file system it is loaded, else it is loaded from the
   * classpath. (string)
   *
   * @see http://doc.akka.io/docs/akka/2.0.2/general/configuration.html
   * for more information
   */
  final val AKKA_EXTERN_CONFIG = "sirius.akka.system-config-overrides"

  /**
   * The name of the ActorSystem. Defaults to sirius-system. (string)
   *
   * End users will probably never override this, but it is convenient
   * for when running multiple nodes on the same host sharing the same
   * log, ie when testing :).
   */
  final val AKKA_SYSTEM_NAME = "sirius.akka.actor-system.name"

  /**
   * Location of cluster membership configuration file (string)
   */
  final val CLUSTER_CONFIG = "sirius.membership.config-path"

  /**
   * How often to check CLUSTER_CONFIG for updates, in seconds (int).
   * Also is used to control how often Supervisor checks for updates to membership.
   */
  final val MEMBERSHIP_CHECK_INTERVAL = "sirius.membership.check-interval-secs"

  /**
   * How often to ping the other members of the cluster, recording round-trip.
   * Useful for determining cluster liveness.
   */
  final val MEMBERSHIP_PING_INTERVAL = "sirius.membership.ping-interval-secs"

  /**
   * How often to check the membershipAgent for updates, in seconds (int).
   * Used by the supervisor when determining whether to keep paxos on or off.
   */
  final val PAXOS_MEMBERSHIP_CHECK_INTERVAL = "sirius.supervisor.paxos-check-interval-secs"

  /**
   * How often the LeaderWatcher spawns a LeaderPinger to check on the currently elected leader.
   */
  final val PAXOS_LEADERSHIP_PING_INTERVAL = "sirius.paxos.leadership-ping-interval"

  /**
   * How long to wait for a Pong response from the elected leader before declaring it "gone"
   */
  final val PAXOS_LEADERSHIP_PING_TIMEOUT = "sirius.paxos.leadership-ping-timeout"

  /**
   * Directory to put UberStore in (string)
   */
  final val LOG_LOCATION = "sirius.uberstore.dir"

  /**
   * Maximum events per Segment in a SegmentedUberStore. Determines how many events will be
   * written before splitting off a new Segment on disk.
   */
  final val LOG_EVENTS_PER_SEGMENT = "sirius.uberstore.max-events-per-segment"

  /**
   * Which SiriusLog implementation to use. See versionId method on classes that implement
   * the SiriusLog trait for possible values. Empty defaults to legacy UberStore.
   */
  final val LOG_VERSION_ID = "sirius.uberstore.impl-version-id"

  /**
   * True to use PersistedSeqIndex (write-through java.util.TreeMap fronted
   * uberstore index file implementation), false to use DiskOnlySeqIndex
   * (raw disk operation uberstore index file implementation). DiskOnlySeqIndex
   * drastically reduces memory overhead (even in the order of gigabytes less
   * consumption) at the expense of potentially less performant lookup
   * operations (boolean)
   */
  @deprecated("Not honored as of sirius-1.0.4, uses raw disk operations only", "2013-05-15")
  final val LOG_USE_MEMORY_INDEX = "sirius.uberstore.use-in-memory-index"

  /**
   * Whether or not to use the write cache, which will cache the last
   * LOG_WRITE_CACHE_SIZE entries written to the log since startup.
   * May alleviate disk pressure and improve catch up speed, but at
   * the expense of higher memory overhead and (likely) incompatibility
   * with eventual live compaction (boolean)
   */
  final val LOG_USE_WRITE_CACHE = "sirius.log.write-cache-enabled"

  /**
   * By default Sirius places a write through cache in front of the
   * log, this property dictates its maximum size (int)
   */
  final val LOG_WRITE_CACHE_SIZE = "sirius.log.write-cache-size"

  /**
   * Minutes between triggering compaction. First trigger will happen this many minutes
   * after boot.  A value of 0 turns off compaction, and compaction is off by default.
   */
  final val COMPACTION_SCHEDULE_MINS = "sirius.log.compaction-schedule-mins"

  /**
   * Name of the sirius supervisor, typically we will not change this,
   * but it's here just in case (string)
   */
  final val SIRIUS_SUPERVISOR_NAME = "sirius.supervisor.name"

  /**
   * Number of milliseconds for a proposal to live with the possibility
   * of being reproposed.  This window is not 100% exact at this point-
   * it's precision is REPROPOSAL_CLEANUP_FREQ (long)
   */
  final val REPROPOSAL_WINDOW = "sirius.paxos.replica.reproposal-window-millis"

  /**
   * How often, in seconds, to reap old proposals (int)
   */
  final val REPROPOSAL_CLEANUP_FREQ = "sirius.paxos.replica.reproposal-freq-secs"

  /**
   * Number of milliseconds for Acceptors to retain PValues. When cleaning up in
   * the Acceptors we remove PValues from the acceptor in slot number order until
   * we encounter one which is within the retention window.  At this point we stop
   * cleaning up. Note that it is possible that PValues outside of the this window
   * may be retained if there is a PValue with a timestamp that is within the window
   * before it. (long)
   *
   * Similar to REPROPOSAL_WINDOW, precision is ACCEPTOR_CLEANUP_FREQ
   */
  final val ACCEPTOR_WINDOW = "sirius.paxos.acceptor.acceptor-window-millis"

  /**
   * How often, in seconds, to clean up the Acceptor (int)
   */
  final val ACCEPTOR_CLEANUP_FREQ = "sirius.paxos.acceptor.acceptor-cleanup-freq-secs"

  /**
   * An MBeanServer, that if configured, will be used to expose metrics around Sirius
   * (MBeanServer)
   */
  final val MBEAN_SERVER = "sirius.monitoring.mbean-server"

  /**
   * Number of events to request from a remote node in a single chunk
   */
  final val LOG_REQUEST_CHUNK_SIZE = "sirius.log-request.chunk-size"

  /**
   * How long (in seconds) to wait for a log chunk reply before considering it timed out
   */
  final val LOG_REQUEST_RECEIVE_TIMEOUT_SECS = "sirius.log-request.receive-timeout-secs"

  /**
   * How long (in seconds) to wait between checking for gaps
   */
  final val LOG_REQUEST_FREQ_SECS = "sirius.log-request.freq-secs"

  /**
   * How long (in milliseconds) for requests in SiriusImpl to wait for a response from
   * the underlying actor (int)
   */
  final val CLIENT_TIMEOUT_MS = "sirius.client.ask-timeout-ms"

}

/**
 * Configuration object for Sirius.  Encapsulates arbitrary String key/Any value data.
 *
 * @see SiriusConfiguration$ constants for information of fields.
 */
class SiriusConfiguration {

  private var conf = Map[String, Any]()

  /**
   * Return the underlying Map[String, Any] configuring this instance
   *
   * Not Java API friendly, if we so find the need, we can add a conversion
   *
   * @return Map[String, Any] of all configuration
   */
  def getConfigMap: Map[String, Any] = conf

  /**
   * Set an arbitrary property on this configuration
   *
   * @param name name of the property
   * @param value value to associate with name
   */
  def setProp(name: String, value: Any) {
    conf += (name -> value)
  }

  /**
   * Get a property from this configuration
   *
   * @param name property name to get
   *
   * @return Some(value) if it exists, or None if not
   */
  def getProp[T](name: String): Option[T] = conf.get(name).asInstanceOf[Option[T]]

  /**
   * Get a property with a default fallback
   *
   * @param name property name to get
   * @param default the value to return if the property doesn't exist
   *
   * @return the value stored under name, or the default if it's not found
   */
  def getProp[T](name: String, default: T): T = conf.get(name) match {
    case Some(value) => value.asInstanceOf[T]
    case None => default
  }

}


text:
var express = require('express');
var buttonModel = require('../../DAL/Entity/EntityButtons');
var BALButtons = require('../../BAL/Business/BusinessGlobalConfig');
var router = express.Router();

router.get('/api/Insert/:PartitionKey/:RowKey/:ID_Reference/:ID_Caller/:ID_Service/:ID_Close/:Ini_Date_Service/:Ini_Date_Caller/:End_Date_Service/:End_Date_Caller/:ActiveService/:ActiveCaller/:Innings/:Zone/:Place/:Pais/:ID_Pais/:ReCall_Call/:ReCall_Service/:Liable/:Type_Close_Call', function(req, res){
    var parameters ;
    new BALButtons(parameters).insert(parameters).then(function(result){
      var reslp = JSON.parse(result);
      res.send(reslp);
    }).catch(function(error){
      console.log('Ups.... a ocurrido un error.');
      res.sendFile('Ups.... a ocurrido un error.');
    });
});

router.get('/api/Delete/:ID_Pais/:Place/:ID_Reference', function(req, res){
  var parameters = new buttonModel({
    Place               : String(req.params.Place),
    ID_Pais 	          : Number(req.params.ID_Pais),
    ID_Reference        : String(req.params.ID_Reference)
  });
  new BALButtons(parameters).delete(parameters).then(function(result){
    var reslp = JSON.parse(result);
    res.send(reslp);
  }).catch(function(error){
    console.log('Ups.... a ocurrido un error.');
    res.sendFile('Ups.... a ocurrido un error.');
  });
});

router.get('/api/UpdateOneByIdForPlace/:ID_Pais/:Place', function(req, res){
  var parameters ;
  new BALButtons(parameters).updateOneByIdForPlace(parameters).then(function(result){
    var reslp = JSON.parse(result);
    res.send(reslp);
  }).catch(function(error){
    console.log('Ups.... a ocurrido un error.');
    res.sendFile('Ups.... a ocurrido un error.');
  });
});

router.get('/api/GetOneByIdForPlace/:ID_Pais/:Place/:ID_Reference', function(req, res){
  var parameters = new buttonModel({
    Place             : String(req.params.Place),
    ID_Pais 	        : Number(req.params.ID_Pais),
    ID_Reference      : String(req.params.ID_Reference)
  });
  new BALButtons(parameters).getOneByIdForPlace(parameters).then(function(result){
    var reslp = JSON.parse(result);
    res.send(reslp);
  }).catch(function(error){
    console.log('Ups.... a ocurrido un error.');
    res.sendFile('Ups.... a ocurrido un error.');
  });
});

router.get('/api/GetAllForPlace/:ID_Pais/:Place', function(req, res){
  var parameters = new buttonModel({
    Place     : String(req.params.Place),
    ID_Pais 	: Number(req.params.ID_Pais)
  });
  new BALButtons(parameters).getAllForPlace(parameters).then(function(result){
    var reslp = JSON.parse(result);
    res.send(reslp);
  }).catch(function(error){
    console.log('Ups.... a ocurrido un error.');
    res.sendFile('Ups.... a ocurrido un error.');
  });
});
module.exports = router;


text:
#ifndef _SCC_TICK2TIME_H_
#define _SCC_TICK2TIME_H_

//clang-format off
#include "utilities.h"
#include <systemc>
#ifdef CWR_SYSTEMC
#include "scml_clock/scml_clock_if.h"
#endif
//clang-format on

/** \ingroup scc-sysc
 *  @{
 */
/**@{*/
//! @brief SCC SystemC utilities
namespace scc {
/**
 * @struct time2tick
 * @brief translate a tick-less clock (sc_time based) to boolean clock
 *
 */
struct tick2time : public sc_core::sc_module
#ifdef CWR_SYSTEMC
,
                   public scml_clock_observer
#endif
{
    //! the clock output
    sc_core::sc_out<sc_core::sc_time> clk_o{"clk_o"};
    //! the clock input
    sc_core::sc_in<bool> clk_i{"clk_i"};
    /**
     * the constructor
     *
     * @param nm the name
     */
    explicit tick2time(sc_core::sc_module_name nm);

protected:
    void end_of_elaboration() override;

private:
    sc_core::sc_time clk_period;
    sc_core::sc_time last_tick;
#ifdef CWR_SYSTEMC
    void handle_clock_parameters_updated(scml_clock_if* clk_if);
    void handle_clock_deleted(scml_clock_if*) override;
#endif
};
} // namespace scc
/** @} */ // end of scc-sysc
#endif /* _SCC_TICK2TIME_H_ */


text:
package com.stratio.crossdata.common

import java.util.UUID

import akka.cluster.ClusterEvent.CurrentClusterState
import com.stratio.crossdata.common.result.SQLResult
import com.stratio.crossdata.common.security.Session
import com.typesafe.config.Config

import scala.collection._
import scala.concurrent.duration.FiniteDuration

// Driver -> Server messages
trait Command {
  private[crossdata] val requestId = UUID.randomUUID()
}

case class SQLCommand private(sql: String,
                                                 queryId: UUID = UUID.randomUUID(),
                                                 flattenResults: Boolean = false,
                                                 timeout: Option[FiniteDuration] = None
                                                ) extends Command {

  def this(query: String,
           retrieveColNames: Boolean,
           timeoutDuration: FiniteDuration
          ) = this(sql = query, flattenResults = retrieveColNames, timeout = Option(timeoutDuration))

  def this(query: String,
           retrieveColNames: Boolean
          ) = this(sql = query, flattenResults = retrieveColNames, timeout = None)

}

case class AddJARCommand(path: String, hdfsConfig: Option[Config] = None,
                         timeout: Option[FiniteDuration] = None, toClassPath:Option[Boolean]= None
                        ) extends Command {
  def this(
            jarpath: String,
            timeout: FiniteDuration
          ) = this(path = jarpath, timeout = Option(timeout))

  def this(jarpath: String) = this(path = jarpath)

  def this(
            jarpath: String,
            hdfsConf: Config
          ) = this(path = jarpath, hdfsConfig = Option(hdfsConf))

  def this (jarpath: String,
            toClassPath: Boolean
           ) = this(path = jarpath, toClassPath = Option(toClassPath))
}

case class AddAppCommand(path: String,alias:String,clss:String,
                         timeout: Option[FiniteDuration] = None
                        ) extends Command {
  def this(
            jarpath: String,
            alias:String,
            clss:String,
            timeout: FiniteDuration
          ) = this(path = jarpath, alias,clss, timeout = Option(timeout))

  def this(
            jarpath: String,
            alias:String,
            clss:String
          )= this(jarpath, alias,clss,None)

}
case class ClusterStateCommand() extends Command

case class OpenSessionCommand( user: String) extends Command

case class CloseSessionCommand() extends Command

trait ControlCommand extends Command

private[crossdata] case class GetJobStatus() extends ControlCommand

private[crossdata] case class CancelQueryExecution(queryId: UUID) extends ControlCommand

/*
  Note that this message implies that the server trust the client in regard to the relation between the session id
   and the user. This assumption will be taken for granted until the model of session management changes from
   trusted-client management to server management.
 */
private[crossdata] case class CommandEnvelope(cmd: Command, session: Session)

// Server -> Driver messages
private[crossdata] trait ServerReply {
  def requestId: UUID
}

private[crossdata] case class QueryCancelledReply(requestId: UUID, cancellationRequest: UUID) extends ServerReply

private[crossdata] case class SQLReply(requestId: UUID, sqlResult: SQLResult) extends ServerReply

/**
  * This class encapsulates the information about the state of the Crossdata cluster.
  *
  * @param requestId Identifier of the request (query or command launched by the user).
  * @param clusterState Information about the Akka cluster.
  * @param sessionCluster Set of nodes sharing the sessions data. Format: [host]:port. Example: [127.0.0.1]:5701.
  */
private[crossdata] case class ClusterStateReply(
                                                 requestId: UUID,
                                                 clusterState: CurrentClusterState,
                                                 sessionCluster: Set[String] = Set.empty[String]) extends ServerReply

private[crossdata] case class OpenSessionReply(requestId: UUID, isOpen: Boolean) extends ServerReply

private[crossdata] case class AddHdfsFileReply(requestId: UUID, hdfsRoute: String) extends ServerReply


text:
\begin{figure}[htb]

    \noindent\makebox[\textwidth]{
        \centering
        %\includegraphics[width=0.8\textwidth]{../../sympy/catalan/coloured.pdf}

        % using *angle* property to rotate it is difficult to properly align it
        % in order to have a "real" matrix representation.
        \includegraphics[width=6cm, height=6cm, keepaspectratio=true]{../RART2015/catalan-tikz/principal-cluster/principal-cluster.pdf}
    }

    % this 'particular' line is necessary to use `displaymath' environment
    % into the caption environment, togheter with the inclusion of
    % `caption' package. See here for more explanation:
    % http://stackoverflow.com/questions/2716227/adding-an-equation-or-formula-to-a-figure-caption-in-latex
    \captionsetup{singlelinecheck=off}
    \caption[$\mathcal{C}_{\equiv_{2}}^{(4)}$
    contains a copy of $\mathcal{C}_{\equiv_{2}}^{(3)}$]{$\hat{d}_{s,2^{3}-1}$ for $s\in S_{2^{3}-1}$,
    $d_{s,2^{3}-1+e} \equiv_{2} d_{s-2^{3},e-1}$ with $e\in\lbrace1,\ldots,s-2^{3}\rbrace$ }

    \label{fig:catalan-principal-cluster}

\end{figure}


text:
package net.afpro.gl;

import android.graphics.Bitmap;
import android.opengl.GLUtils;

import javax.microedition.khronos.opengles.GL10;
import java.util.HashMap;
import java.util.Map;

/**
 * at 11:20 AM, 9/6/12
 *
 * @author apfro
 */
public abstract class TexturedRenderer extends Renderer {
    private final Map<String, Integer> map = new HashMap<String, Integer>();

    protected abstract Bitmap getBitmap(String name);

    @Override
    protected int getTexture(GL10 gl, String name) {
        Integer old = map.get(name);
        if (old != null) {
            return old;
        }

        final Bitmap bmp = getBitmap(name);
        if (bmp == null) {
            return 0;
        }

        int[] buf = new int[1];
        gl.glGenTextures(1, buf, 0);
        gl.glBindTexture(GL10.GL_TEXTURE_2D, buf[0]);
        GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bmp, 0);

        return buf[0];
    }
}


text:
class Float
  def to_percent(digits_after_decimal=2)
    (self * 100).round digits_after_decimal
  end

  def to_formatted_percent
    to_percent.to_s + '%'
  end
end


text:
import * as types from '../constants/ActionTypes';

const defaultAuth = { isLoginFetching: false, isLogoutFetching: false, token: null };

export default function auth(state = defaultAuth, action) {
  switch (action.type) {
    case types.LOGIN_REQUEST:
      return { ...defaultAuth, isLoginFetching: true };
    case types.LOGIN_SUCCESS:
      return { ...defaultAuth, token: action.token };
    case types.LOGIN_FAILED:
      return defaultAuth;
    case types.LOGOUT_REQUEST:
      return { ...state, token: null };
    case types.LOGOUT_SUCCESS:
      return defaultAuth;
    case types.LOGOUT_FAILED:
      return { ...state, isLogoutFetching: false };
    default:
      return state;
  }
}


text:
<!DOCTYPE html>

<meta charset="utf-8">
<title>text-align: start, direction: ltr</title>
<link rel='author' title='Richard Ishida' href='mailto:ishida@w3.org'>
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css">

Test passes if the shading in both orange boxes is identical.

REF REF REF REF REF REF REF REF

REF REF REF REF REF REF REF REF


text:
<?php

namespace Richpolis\GalMonBundle\Repository;

use Doctrine\ORM\EntityRepository;

/**
 * VideosRepository
 *
 * This class was generated by the Doctrine ORM. Add your own custom
 * repository methods below.
 */
class VideosRepository extends EntityRepository
{
    public function getMaxPosicion() {
        $em = $this->getEntityManager();
        $query = $em->createQuery('
            SELECT MAX(v.posicion) as value
            FROM RichpolisGalMonBundle:Videos v
            ORDER BY v.posicion ASC
            ');
        $max = $query->getResult();
        return $max[0]['value'];
    }

    public function getQueryVideosActivas($todas=false){
        $query=$this->createQueryBuilder('v')
                    ->orderBy('v.posicion', 'ASC');
        if(!$todas){
            $query->andwhere('v.isActive=:active')
                  ->setParameter('active', true);
        }
        return $query->getQuery();
    }

    public function getVideosActivas($todas=false){
        $query=$this->getQueryVideosActivas($todas);
        return $query->getResult();
    }

    public function getRegistroUpOrDown($posicionRegistro,$up=true){
        // $up = true, $up = false is down
        if($up){
            //up
            $query=$this->createQueryBuilder('p')
                    ->where('p.posicion>:posicion')
                    ->setParameter('posicion', $posicionRegistro)
                    ->orderBy('p.posicion', 'DESC');
        }else{
            //down
            $query=$this->createQueryBuilder('p')
                    ->where('p.posicion<:posicion')
                    ->setParameter('posicion', $posicionRegistro)
                    ->orderBy('p.posicion', 'DESC');
        }

        return $query->getQuery()->setMaxResults(1)->getOneOrNullResult();
    }

    public function getVideoSemana($id=0){
        if($id){
           return $this->find($id);
        }else{
            $query=$this->createQueryBuilder('v');
            $query->orderBy('v.posicion', 'DESC');
            $query->setMaxResults(1);
            return $query->getQuery()->getOneOrNullResult();
        }

    }
}


text:
#region Copyright (c) 2004 Ian Davis and James Carlyle

#endregion
namespace SemPlan.Spiral.Core {
  using System;
  using System.Collections;

	///
	/// Represents a set of triples
	///
  /// <remarks>
  /// $Id: TripleStore.cs,v 1.4 2006/02/13 23:42:49 ian Exp $
  ///</remarks>
  public interface TripleStore : ResourceStatementCollection, ResourceMap, ICloneable, IDisposable {

    StatementHandler GetStatementHandler();

    IEnumerator Solve(Query query);
    void Evaluate(Rule rule);

    /// Write this TripleStore to the supplied RdfWriter.
    void Write(RdfWriter writer);

    /// Adds a statement of knowledge about a resource to the TripleStore
    /// <param name="statement">The statement to add to the TripleStore</param>
    void Add(Statement statement);
    bool Contains( Statement statement );

    void Add(TripleStore other);
    void Add(ResourceDescription description);
    void Merge(ResourceStatementCollection statements, ResourceMap map);

   /// Clears all triples, nodes and resources from this triple store
    void Clear();

    /// <returns>A bounded description generated according to the specified strategy.</returns>
    ResourceDescription GetDescriptionOf(Resource theResource, BoundingStrategy strategy);

    /// <returns>A bounded description generated according to the specified strategy.</returns>
    ResourceDescription GetDescriptionOf(Node theNode, BoundingStrategy strategy);

  }
}


text:
namespace chromeos {

class CHROMEOS_EXPORT IBusText {
 public:
  enum IBusTextUnderlineType {
    IBUS_TEXT_UNDERLINE_SINGLE = 1,
    IBUS_TEXT_UNDERLINE_DOUBLE = 2,
    IBUS_TEXT_UNDERLINE_ERROR  = 4,
  };

  struct UnderlineAttribute {
    IBusTextUnderlineType type;
    uint32 start_index;  // The inclusive start index.
    uint32 end_index;  // The exclusive end index.
  };

  // Accessors
  IBusText();
  virtual ~IBusText();

  const std::string& text() const { return text_; }
  void set_text(const std::string& text) { text_ = text; }

  const std::vector<UnderlineAttribute>& underline_attributes() const {
    return underline_attributes_;
  }

  std::vector<UnderlineAttribute>* mutable_underline_attributes() {
    return &underline_attributes_;
  }

  uint32 selection_start() const { return selection_start_; }
  void set_selection_start(uint32 selection_start) {
    selection_start_ = selection_start;
  }

  uint32 selection_end() const { return selection_end_; }
  void set_selection_end(uint32 selection_end) {
    selection_end_ = selection_end;
  }

  void CopyFrom(const IBusText& obj);

 private:
  std::string text_;
  std::vector<UnderlineAttribute> underline_attributes_;
  uint32 selection_start_;
  uint32 selection_end_;

  DISALLOW_COPY_AND_ASSIGN(IBusText);
};

}  // namespace chromeos

#endif  // CHROMEOS_IME_IBUS_TEXT_H_


text:
<?xml version="1.0" encoding="utf-8"?>
<company>
   <product-line id="Platform" order="10.0" title="架构" >
      <domain id="Cat"/>
      <domain id="PumaServer"/>
      <domain id="SessionService"/>
   </product-line>
</company>


text:
static NSGradient *_ActiveGradient = nil;
static NSGradient *_InactiveGradient = nil;
static NSGradient *_HighlightedGradient = nil;

@implementation RKBarButtonCell

+ (void)initialize
{
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        _ActiveGradient = [[NSGradient alloc] initWithStartingColor:[NSColor colorWithCalibratedRed:0.96 green:0.96 blue:0.96 alpha:1.00]
                                                        endingColor:[NSColor colorWithCalibratedRed:0.77 green:0.77 blue:0.77 alpha:1.00]];

        _InactiveGradient = [[NSGradient alloc] initWithStartingColor:[NSColor colorWithCalibratedRed:0.95 green:0.95 blue:0.95 alpha:1.00]
                                                          endingColor:[NSColor colorWithCalibratedRed:0.91 green:0.91 blue:0.91 alpha:1.00]];

        _HighlightedGradient = [[NSGradient alloc] initWithStartingColor:[NSColor colorWithCalibratedRed:0.51 green:0.51 blue:0.51 alpha:1.00]
                                                             endingColor:[NSColor colorWithCalibratedRed:0.62 green:0.62 blue:0.62 alpha:1.00]];
    });

    [super initialize];
}

- (RKBarButtonCell *)initWithType:(RKBarButtonType)type title:(NSString *)title
{
    if((self = [super initTextCell:title])) {
        self.buttonType = type;

        [self setFont:[NSFont boldSystemFontOfSize:11.0]];
        [self setBezelStyle:NSTexturedSquareBezelStyle];
        [self setHighlightsBy:NSMomentaryLight];
        [self setTitle:title];
    }

    return self;
}

#pragma mark - Sizing

- (NSSize)cellSize
{
    NSSize cellSize = [super cellSize];
    cellSize.width = MAX(MIN_DEFAULT_WIDTH, cellSize.width) + 10.0;

    if(_buttonType == kRKBarButtonTypeBackButton) {
        cellSize.width += ARROW_WIDTH;
    }

    cellSize.height = 23.0;

    return cellSize;
}

#pragma mark - Drawing

- (void)drawBezelWithFrame:(NSRect)frame inView:(NSView *)controlView
{
    NSBezierPath *backgroundPath = nil;
	if(_buttonType == kRKBarButtonTypeBackButton) {
		backgroundPath = [NSBezierPath bezierPath];
		[backgroundPath setLineWidth:1.0];
		[backgroundPath moveToPoint:frame.origin];

		//Start at the bottom.
		[backgroundPath moveToPoint:NSMakePoint(NSMinX(frame), NSMidY(frame))];

		//Draw a line from the centre point to the upper left corner.
		[backgroundPath lineToPoint:NSMakePoint(NSMinX(frame) + ARROW_WIDTH, NSMaxY(frame))];

		//Draw a line from the last point to the upper right corner.
		[backgroundPath appendBezierPathWithArcFromPoint:NSMakePoint(NSMaxX(frame), NSMaxY(frame))
												 toPoint:NSMakePoint(NSMaxX(frame), NSMaxY(frame) - BORDER_RADIUS)
												  radius:BORDER_RADIUS];

		//Draw a line from the last point to the lower right corner.
		[backgroundPath appendBezierPathWithArcFromPoint:NSMakePoint(NSMaxX(frame), NSMinY(frame))
												 toPoint:NSMakePoint(NSMaxX(frame) - BORDER_RADIUS, NSMinY(frame))
												  radius:BORDER_RADIUS];

		//Draw a line from the last point to the centre point on the left side.
		[backgroundPath lineToPoint:NSMakePoint(NSMinX(frame) + ARROW_WIDTH, NSMinY(frame))];

		//Close the path so stroking looks right.
		[backgroundPath closePath];
	} else if(_buttonType == kRKBarButtonTypeDefault) {
		backgroundPath = [NSBezierPath bezierPathWithRoundedRect:frame xRadius:BORDER_RADIUS yRadius:BORDER_RADIUS];
	}

    if(self.isHighlighted) {
        [_HighlightedGradient drawInBezierPath:backgroundPath angle:90.0];

        NSShadow *innerShadow = [NSShadow new];
        [innerShadow setShadowBlurRadius:4.0];
        [innerShadow setShadowOffset:NSMakeSize(0.0, -1.0)];
        [innerShadow setShadowColor:[NSColor colorWithDeviceWhite:0.0 alpha:0.4]];
        [backgroundPath fillWithInnerShadow:innerShadow];

        [[NSColor colorWithCalibratedRed:0.42 green:0.42 blue:0.42 alpha:1.00] set];
    } else {
        if([[controlView window] isMainWindow]) {
            [_ActiveGradient drawInBezierPath:backgroundPath angle:90.0];
            [[NSColor colorWithCalibratedRed:0.42 green:0.42 blue:0.42 alpha:1.00] set];
        } else {
            [_InactiveGradient drawInBezierPath:backgroundPath angle:90.0];
            [[NSColor colorWithCalibratedRed:0.75 green:0.75 blue:0.75 alpha:1.00] set];
        }
    }

    [backgroundPath strokeInside];
}

- (void)drawImage:(NSImage *)image withFrame:(NSRect)frame inView:(NSView *)controlView
{
    if(_buttonType == kRKBarButtonTypeBackButton) {
        frame.origin.x += ARROW_WIDTH - 2.0;
        frame.size.width -= ARROW_WIDTH;
    } else if(_buttonType == kRKBarButtonTypeDefault) {
    }

    [super drawImage:image withFrame:frame inView:controlView];
}

- (NSRect)drawTitle:(NSAttributedString *)title withFrame:(NSRect)frame inView:(NSView *)controlView
{
    if(_buttonType == kRKBarButtonTypeBackButton) {
        frame.origin.x += ARROW_WIDTH - 2.0;
        frame.size.width -= ARROW_WIDTH;
    } else if(_buttonType == kRKBarButtonTypeDefault) {
    }

    frame.origin.y += 1.0;

    return [super drawTitle:title withFrame:frame inView:controlView];
}

@end


text:
package com.wamad.servlet;

import com.google.common.base.Throwables;
import com.wamad.IRCClient;
import com.wamad.Message;
import org.codehaus.jackson.map.ObjectMapper;

import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

/**
 * Date: 3/3/12
 * Time: 3:39 PM
 */
@Singleton
public class Post extends HttpServlet {
  private final IRCClient client;
  private final String chatRoom;
  private final ObjectMapper mapper = new ObjectMapper();

  @Inject
  public Post(final IRCClient client, @Named("wamad.irc.chat") final String chatRoom) {
    this.client = client;
    this.chatRoom = chatRoom;
  }

  @Override
  public void init() throws ServletException {
    super.init();
    try {
      this.client.init();
      this.client.join(this.chatRoom);
    } catch (IOException e) {
      Throwables.propagate(e);
    }
  }

  protected void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
    String name = request.getParameter("name");
    String say = request.getParameter("say");
    this.client.say(say);

    List<Message> messages = client.getAndClearMessages();
    // convert
    String data = mapper.writeValueAsString(messages);

//    response.setContentType("application/json");
    response.setContentType("text/html");
    response.setStatus(HttpServletResponse.SC_OK);
    response.getWriter().println(data);

  }

}


text:
<?php

// /home/ethan/www/dev.symfony.com/src/Acme/DemoBundle/Resources/views/Welcome/index.html.twig
return array (
);


text:
package org.jvnet.jaxb2_commons.plugin.copyable;

import javax.xml.namespace.QName;

public class Customizations {

	public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/copyable";

	public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI,
			"ignored");

}


text:
<?php

namespace Kendo\Dataviz\UI;

class ChartCategoryAxisItemMajorGridLines extends \Kendo\SerializableObject {
//>> Properties

    /**
    * The color of the major grid lines. Accepts a valid CSS color string, including hex and rgb.
    * @param string $value
    * @return \Kendo\Dataviz\UI\ChartCategoryAxisItemMajorGridLines
    */
    public function color($value) {
        return $this->setProperty('color', $value);
    }

    /**
    * The dash type of the major grid lines.The following dash types are supported:
    * @param string $value
    * @return \Kendo\Dataviz\UI\ChartCategoryAxisItemMajorGridLines
    */
    public function dashType($value) {
        return $this->setProperty('dashType', $value);
    }

    /**
    * If set to true the chart will display the major grid lines. By default the major grid lines are visible.
    * @param boolean $value
    * @return \Kendo\Dataviz\UI\ChartCategoryAxisItemMajorGridLines
    */
    public function visible($value) {
        return $this->setProperty('visible', $value);
    }

    /**
    * The width of the category axis major grid lines in pixels.
    * @param float $value
    * @return \Kendo\Dataviz\UI\ChartCategoryAxisItemMajorGridLines
    */
    public function width($value) {
        return $this->setProperty('width', $value);
    }

    /**
    * The step of the category axis major grid lines.
    * @param float $value
    * @return \Kendo\Dataviz\UI\ChartCategoryAxisItemMajorGridLines
    */
    public function step($value) {
        return $this->setProperty('step', $value);
    }

    /**
    * The skip of the category axis major grid lines.
    * @param float $value
    * @return \Kendo\Dataviz\UI\ChartCategoryAxisItemMajorGridLines
    */
    public function skip($value) {
        return $this->setProperty('skip', $value);
    }

//<< Properties
}

?>


text:
@interface MethodsFactoredParserTest ()
@property (nonatomic, retain) PKParserFactory *factory;
@property (nonatomic, retain) PKRootNode *root;
@property (nonatomic, retain) PKSParserGenVisitor *visitor;
@property (nonatomic, retain) MethodsFactoredParser *parser;
@end

@implementation MethodsFactoredParserTest

- (void)setUp {
    self.factory = [PKParserFactory factory];
    _factory.collectTokenKinds = YES;

    NSError *err = nil;
    NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"methods_factored" ofType:@"grammar"];
    NSString *g = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:&err];

    err = nil;
    self.root = (id)[_factory ASTFromGrammar:g error:&err];
    _root.grammarName = @"MethodsFactored";

    self.visitor = [[[PKSParserGenVisitor alloc] init] autorelease];
    [_root visit:_visitor];

    self.parser = [[[MethodsFactoredParser alloc] init] autorelease];

#if TD_EMIT
    path = [@"~/work/parsekit/trunk/test/MethodsFactoredParser.h" stringByExpandingTildeInPath];
    err = nil;
    if (![_visitor.interfaceOutputString writeToFile:path atomically:YES encoding:NSUTF8StringEncoding error:&err]) {
        NSLog(@"%@", err);
    }

    path = [@"~/work/parsekit/trunk/test/MethodsFactoredParser.m" stringByExpandingTildeInPath];
    err = nil;
    if (![_visitor.implementationOutputString writeToFile:path atomically:YES encoding:NSUTF8StringEncoding error:&err]) {
        NSLog(@"%@", err);
    }
#endif
}

- (void)tearDown {
    self.factory = nil;
}

- (void)testAddDecl {
    NSError *err = nil;
    PKAssembly *res = [_parser parseString:@"int add(int a);" assembler:nil error:&err];

    TDEqualObjects(@"[int, add, (, int, a, ), ;]int/add/(/int/a/)/;^", [res description]);
}

- (void)testAddDef {
    NSError *err = nil;
    PKAssembly *res = [_parser parseString:@"int add(int a) { }" assembler:nil error:&err];

    TDEqualObjects(@"[int, add, (, int, a, ), {, }]int/add/(/int/a/)/{/}^", [res description]);
}

@end


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
<title>FunctionToPrimitiveLong (Neo4j Community 2.0.0 API)</title>
<meta name="date" content="2013-12-08">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Neo4j Community

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

org.neo4j.helpers

Interface FunctionToPrimitiveLong<T>

public interface FunctionToPrimitiveLong<T>

Method Summary

Methods

Modifier and Type
Method and Description

long
apply(T value)

Method Detail

apply

long apply(T value)

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Neo4j Community

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

Copyright © 2002–2013 The Neo4j Graph Database Project. All rights reserved.


text:
[![Version](https://img.shields.io/cocoapods/v/TLMetaResolver.svg?style=flat)](http://cocoadocs.org/docsets/TLMetaResolver)
[![License](https://img.shields.io/cocoapods/l/TLMetaResolver.svg?style=flat)](http://cocoadocs.org/docsets/TLMetaResolver)
[![Platform](https://img.shields.io/cocoapods/p/TLMetaResolver.svg?style=flat)](http://cocoadocs.org/docsets/TLMetaResolver)
[![Laguage](https://img.shields.io/badge/language-Swift-orange.svg)](https://developer.apple.com/swift/)

TLMetaResolver is an extension to UIWebView writen in Swift that adds the ability to parse the meta tags in the loaded web page and extract information about a native app that can be deep linked from that page. This method is used for Twitter and Facebook to deep link to a native app from a posted web page. The meta tags definitions handled for TLMetaResolver are:

- [Twitter App Cards](https://dev.twitter.com/cards/types/app)
- [Facebook App Link](http://applinks.org/documentation/)
- [Apple Smart Banner](https://developer.apple.com/library/ios/documentation/AppleApplications/Reference/SafariWebContent/PromotingAppswithAppBanners/PromotingAppswithAppBanners.html)

## How it works

TLMetaResolver adds a funtion to UIWebView that evaluate a JavaScript script in the context of the loaded web page. This script returns an _app id_ and _url_. The _app id_ is the id of the native app on iTunes, the _url_ is a special url used to fire the native app.

With the _app id_ the extension perform a search on iTunes calling the [iTunes Search API](https://www.apple.com/itunes/affiliates/resources/documentation/itunes-store-web-service-search-api.html) to get the app name and icon url. Then the icon image is downloaded and a TLNativeAppInfo object is created and returned in a callback. This object can be used to create a TLNativeAppActivity to be presented in a UIActivityViewController. When the activity is performed a call to ``UIApplication.sharedApplication().openURL()`` is made with the url pointing to the native app.

## Usage

You need to call one of the ``resolveMetaTags()`` functions once your page is loaded and provide a closure conforming the ``TLMetaResolverComplete`` type. Check the example project for a possible implementation, you can ``pod try TLMetaResolver``.

One key point to remember is that ``webViewDidFinishLoad`` function of UIWebViewDelegate can be called many times so you should handle that case to avoid unnecesary calls to ``resolveMetaTags()``. TLMetaResolver don't perform any special consideration at that level.

There are two version of ``resolveMetaTags()`` that have slightly different parameters:

```swift
func resolveMetaTags (onComplete: TLMetaResolverComplete)
```

Both versions has a parameter of type ``TLMetaResolvercomplete`` that is a callback that is fired when the process finish.

```swift
func resolveMetaTags (fetchUrl: TLMetaResolverFetchURL?, _ fetchImage: TLMetaResolverFetchURL?, _ onComplete: TLMetaResolverComplete)
```

The long version has two extra parameters that are closures used to issue the requests to iTunes Search API  (``fetchUrl``)  and the app icon download (``fetchImage``). You can provide the implementation for one of this, both or none (that is the case of the short version of ``resolverMetaTags()``). For the closures you don't provide a default implementation is provided using ``NSURLSession.sharedSession()``.

## Installation

TLMetaResolver is available through [CocoaPods](http://cocoapods.org). To install
it, simply add the following line to your Podfile:

    pod "TLMetaResolver"

You can also do a quick check with:

    pod try TLMetaResolver

Or opt to clone the repo and integrate the code and assets under the Pod/ directory to your project as you like.

## Requirements

iOS >= 8.0

## Author

BrunoBerisso, bruno@tryolabs.com

## License

TLMetaResolver is available under the MIT license. See the LICENSE file for more info.


text:
function(doc, req){
	if(doc.filterthis == 'yes'){
		return true;
	}
	return false;
}


text:
#include <Engine/Renderer/RenderTechnique/ShaderConfiguration.hpp>

#include <Engine/Renderer/RenderTechnique/ShaderProgramManager.hpp>

#include <Core/Resources/Resources.hpp>

/**
 * Plain will be the default shader program
 */
static const std::string defaultVertexShader{Ra::Core::Resources::getRadiumResourcesDir() +
                                             "Shaders/Materials/Plain/Plain.vert.glsl"};
static const std::string defaultFragmentShader{Ra::Core::Resources::getRadiumResourcesDir() +
                                               "Shaders/Materials/Plain/Plain.frag.glsl"};

namespace Ra {
namespace Engine {

ShaderConfiguration ShaderConfiguration::m_defaultShaderConfig( "Default Program",
                                                                defaultVertexShader,
                                                                defaultFragmentShader );

ShaderConfiguration::ShaderConfiguration( const std::string& name ) :
    m_name{name}, m_version{"#version 410"} {}

ShaderConfiguration::ShaderConfiguration( const std::string& name,
                                          const std::string& vertexShader,
                                          const std::string& fragmentShader ) :
    m_name{name}, m_version{"#version 410"} {
    m_shaders[ShaderType_VERTEX]   = {vertexShader, true};
    m_shaders[ShaderType_FRAGMENT] = {fragmentShader, true};
}

void ShaderConfiguration::addShader( ShaderType type, const std::string& name ) {
    m_shaders[type] = {name, true};
}

void ShaderConfiguration::addShaderSource( ShaderType type, const std::string& source ) {
    m_shaders[type] = {source, false};
}

void ShaderConfiguration::addProperty( const std::string& prop ) {
    m_properties.insert( "#define " + prop );
}

void ShaderConfiguration::addProperties( const std::list<std::string>& props ) {
    for ( const auto& prop : props )
    {
        m_properties.insert( "#define " + prop );
    }
}

void ShaderConfiguration::removeProperty( const std::string& prop ) {
    m_properties.erase( "#define " + prop );
}

void ShaderConfiguration::addInclude( const std::string& incl, ShaderType type ) {
    m_includes.emplace_back( "#include " + incl, type );
}

void ShaderConfiguration::addIncludes( const std::list<std::string>& incls, ShaderType type ) {
    for ( const auto& incl : incls )
    {
        m_includes.emplace_back( "#include " + incl, type );
    }
}

void ShaderConfiguration::removeInclude( const std::string& incl, ShaderType type ) {
    CORE_UNUSED( type );
    m_properties.erase( "#include " + incl );
}

void ShaderConfiguration::addNamedString( const std::string& includepath,
                                          const std::string& realfile ) {
    m_named_strings.emplace_back( includepath, realfile );
}

bool ShaderConfiguration::isComplete() const {
    return ( ( !m_shaders[ShaderType_VERTEX].first.empty() ) &&
             ( !m_shaders[ShaderType_FRAGMENT].first.empty() ) ) ||
           !m_shaders[ShaderType_COMPUTE].first.empty();
}

bool ShaderConfiguration::operator<( const ShaderConfiguration& o ) const {
    bool res = false;

    for ( size_t i = 0; i < ShaderType_COUNT; ++i )
    {
        if ( m_shaders[i] != o.m_shaders[i] ) { return m_shaders[i] < o.m_shaders[i]; }
    }

    if ( m_properties.size() == o.m_properties.size() )
    {
        if ( m_properties.empty() )
        {
            if ( m_includes.size() == o.m_includes.size() )
            {
                if ( m_includes.empty() ) { res = false; }
                else
                {
                    auto lit = m_includes.begin();
                    auto rit = o.m_includes.begin();

                    for ( ; ( lit != m_includes.end() ) && ( *lit == *rit ); ++lit, ++rit )
                        ;

                    if ( lit == m_includes.end() ) { res = false; }
                    else
                    { res = *lit < *rit; }
                }
            }
        }
        else
        {
            auto lit = m_properties.begin();
            auto rit = o.m_properties.begin();

            for ( ; ( lit != m_properties.end() ) && ( *lit == *rit ); ++lit, ++rit )
                ;

            if ( lit == m_properties.end() ) { res = false; }
            else
            { res = *lit < *rit; }
        }
    }
    else
    { res = m_properties.size() < o.m_properties.size(); }

    return res;
}

std::set<std::string> ShaderConfiguration::getProperties() const {
    return m_properties;
}

const std::vector<std::pair<std::string, ShaderType>>& ShaderConfiguration::getIncludes() const {
    return m_includes;
}

const std::vector<std::pair<std::string, std::string>>&
ShaderConfiguration::getNamedStrings() const {
    return m_named_strings;
}

} // namespace Engine
} // namespace Ra


text:
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.Xml;
using System.Xml.Serialization;

public class ModLoadConfig
{
    public List<ModEntry> ModLoadOrder = new List<ModEntry>();

    public struct ModEntry
    {
        public ModEntry(string folderName, bool toLoad)
        {
            Name = folderName;
            Load = toLoad;
        }

        public string Name;
        public bool Load;
    }

    public bool hasMod(string modName)
    {
        foreach (ModEntry entry in ModLoadOrder)
        {
            if (entry.Name == modName)
                return true;
        }
        return false;
    }
}


text:
require 'azure/core/error'

module Azure
  module Core
    module Http
      # Public: Class for handling all HTTP response errors
      class HTTPError < Azure::Core::Error

        attr :uri

        # Public: The HTTP status code of this error
        #
        # Returns a Fixnum
        attr :status_code

        # Public: The type of error
        #
        # http://msdn.microsoft.com/en-us/library/azure/dd179357
        #
        # Returns a String
        attr :type

        # Public: Description of the error
        #
        # Returns a String
        attr :description

        # Public: Detail of the error
        #
        # Returns a String
        attr :detail

        # Public: Initialize an error
        #
        # http_response - An Azure::Core::HttpResponse
        def initialize(http_response)
          @http_response = http_response
          @uri = http_response.uri
          @status_code = http_response.status_code
          parse_response
          super("#{type} (#{status_code}): #{description}")
        end

        # Extract the relevant information from the response's body. If the response
        # body is not an XML, we return an 'Unknown' error with the entire body as
        # the description
        #
        # Returns nothing
        def parse_response
          if @http_response.body && @http_response.body.include?('<')

            document = Nokogiri.Slop(@http_response.body)

            @type = document.css('code').first.text if document.css('code').any?
            @type = document.css('Code').first.text if document.css('Code').any?
            @description = document.css('message').first.text if document.css('message').any?
            @description = document.css('Message').first.text if document.css('Message').any?

            # service bus uses detail instead of message
            @detail = document.css('detail').first.text if document.css('detail').any?
            @detail = document.css('Detail').first.text if document.css('Detail').any?
          else
            @type = 'Unknown'
            if @http_response.body
              @description = "#{@http_response.body.strip}"
            end
          end
        end
      end
    end
  end
end


text:
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { GcComponent } from './gc.component';
import { ErrorHandler } from '../../../../shared/units/error-handler';
import { CronScheduleComponent } from '../../../../shared/components/cron-schedule';
import { CronTooltipComponent } from "../../../../shared/components/cron-schedule";
import { of } from 'rxjs';
import { SharedTestingModule } from "../../../../shared/shared.module";
import { GcService } from "../../../../../../ng-swagger-gen/services/gc.service";
import { ScheduleType } from "../../../../shared/entities/shared.const";

describe('GcComponent', () => {
  let component: GcComponent;
  let fixture: ComponentFixture<GcComponent>;
  let gcRepoService: GcService;
  let mockSchedule = [];
  const fakedErrorHandler = {
    error(error) {
      return error;
    },
    info(info) {
      return info;
    }
  };
  let spySchedule: jasmine.Spy;
  let spyGcNow: jasmine.Spy;
  beforeEach(waitForAsync(() => {
    TestBed.configureTestingModule({
      imports: [
        SharedTestingModule
      ],
      declarations: [ GcComponent,  CronScheduleComponent, CronTooltipComponent],
      providers: [
        { provide: ErrorHandler, useValue: fakedErrorHandler },
      ]
    })
    .compileComponents();
  }));

  beforeEach(() => {
    fixture = TestBed.createComponent(GcComponent);
    component = fixture.componentInstance;

    gcRepoService = fixture.debugElement.injector.get(GcService);
    spySchedule = spyOn(gcRepoService, "getGCSchedule").and.returnValues(of(mockSchedule as any));
    spyGcNow = spyOn(gcRepoService, "createGCSchedule").and.returnValues(of(null));
    fixture.detectChanges();
  });
  it('should create', () => {
    expect(component).toBeTruthy();
  });
  it('should get schedule and job', () => {
    expect(spySchedule.calls.count()).toEqual(1);
  });
  it('should trigger gcNow', () => {
    const ele: HTMLButtonElement = fixture.nativeElement.querySelector('#gc-now');
    ele.click();
    fixture.detectChanges();
    expect(spyGcNow.calls.count()).toEqual(1);
  });
  it('should trigger dry run', () => {
    const ele: HTMLButtonElement = fixture.nativeElement.querySelector('#gc-dry-run');
    ele.click();
    fixture.detectChanges();
    expect(spyGcNow.calls.count()).toEqual(1);
  });
  it('getScheduleType function should work', () => {
    expect(GcComponent.getScheduleType).toBeTruthy();
    expect(GcComponent.getScheduleType(null)).toEqual(ScheduleType.NONE);
    expect(GcComponent.getScheduleType('0 0 0 0 0 0')).toEqual(ScheduleType.CUSTOM);
    expect(GcComponent.getScheduleType('0 0 * * * *')).toEqual(ScheduleType.HOURLY);
    expect(GcComponent.getScheduleType('0 0 0 * * *')).toEqual(ScheduleType.DAILY);
    expect(GcComponent.getScheduleType('0 0 0 * * 0')).toEqual(ScheduleType.WEEKLY);
  });
});