void draw_grid(int i,int j,int k) //This draws the grid and changes the color the grid according to the player { beginFrame(); Line h1(0,0,600,0),h2(0,100,600,100), // "h" is the horizontal lines and "v" is the vertical lines h3(0,200,600,200),h4(0,300,600,300), h5(0,400,600,400),h6(0,500,600,500), h7(0,600,600,600),h8(0,700,600,700), h9(0,800,600,800); Line v1(0,0,0,800),v2(100,0,100,800), v3(200,0,200,800),v4(300,0,300,800), v5(400,0,400,800),v6(500,0,500,800), v7(600,0,600,800); h1.setColor(COLOR(255*i,255*j,255*k)),h2.setColor(COLOR(255*i,255*j,255*k)), h3.setColor(COLOR(255*i,255*j,255*k)),h4.setColor(COLOR(255*i,255*j,255*k)), h5.setColor(COLOR(255*i,255*j,255*k)),h6.setColor(COLOR(255*i,255*j,255*k)), h7.setColor(COLOR(255*i,255*j,255*k)),h8.setColor(COLOR(255*i,255*j,255*k)), h9.setColor(COLOR(255*i,255*j,255*k)); v1.setColor(COLOR(255*i,255*j,255*k)),v2.setColor(COLOR(255*i,255*j,255*k)), v3.setColor(COLOR(255*i,255*j,255*k)),v4.setColor(COLOR(255*i,255*j,255*k)), v5.setColor(COLOR(255*i,255*j,255*k)),v6.setColor(COLOR(255*i,255*j,255*k)), v7.setColor(COLOR(255*i,255*j,255*k)); h1.imprint(),h2.imprint(), h3.imprint(),h4.imprint(), h5.imprint(),h6.imprint(), h7.imprint(),h8.imprint(),h9.imprint(); v1.imprint(),v2.imprint(), v3.imprint(),v4.imprint(), v5.imprint(),v6.imprint(),v7.imprint(); endFrame(); }
int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("Sig_Handlers_Test")); ACE_Sig_Handlers multi_handlers; ACE_Select_Reactor reactor_impl (&multi_handlers); ACE_Reactor reactor (&reactor_impl); ACE_Reactor::instance (&reactor); // Create a bevy of handlers. Test_SIGINT_Handler h1 (ACE_Reactor::instance (), "h1"); Test_SIGINT_Handler h2 (ACE_Reactor::instance (), "h2"); Test_SIGINT_Handler h3 (ACE_Reactor::instance (), "h3"); Test_SIGINT_Handler h4 (ACE_Reactor::instance (), "h4"); Test_SIGINT_Handler h5 (ACE_Reactor::instance (), "h5"); Test_SIGINT_Handler h6 (ACE_Reactor::instance (), "h6"); Test_SIGINT_Handler h7 (ACE_Reactor::instance (), "h7"); Test_SIGINT_Handler h8 (ACE_Reactor::instance (), "h8"); Test_SIGINT_Shutdown_Handler h0 (ACE_Reactor::instance ()); // Wait for user to type SIGINT. while (!ACE_Reactor::instance ()->reactor_event_loop_done ()) { ACE_DEBUG ((LM_DEBUG,"\nwaiting for SIGINT\n")); if (ACE_Reactor::instance ()->handle_events () == -1) ACE_ERROR ((LM_ERROR,"%p\n","handle_events")); } ACE_END_TEST; return 0; }
qreal MyWidget::h() { { switch (variant) { case 5: return h5(); case 8: return h8(); } return 0; } }
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, false); 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 is okay, needs be ignored 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 is okay, needs be ignored 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); }
/* --std=c90 -Wv */ void f1(void) { int i; struct tag { int x; } x; int *p; i(); x(); p(); } void f2(void) { void h2(int, double); void g2(); h2(0, 1); g2(0, 1); } /* prototype vs. non-prototype */ void f3(void) { struct tag { int x; } h3(void), x; int g3(void), y; x = h3(); y = g3(); } /* struct vs. non-struct */ void f4(void) { struct tag h4(void); h4(); } /* error - incomplete return */ void f5(void) { void h5(int, double); void g5(void); h5(0, 1); g5(); } /* argument vs. no argument */ void f6(void) { struct tag; void h6(struct tag); struct tag *p; h6(*p); } /* error - incomplete argument */ void f7(void) { void h7(int, ...); int x; h7(x, x, 0); } /* arguments to variadic part */ void f8(void) { struct tag { int x; } x; void h8(int, struct tag, int *); h8(&x, x, &x); } /* error - incompatible argument */
int main() { tQ4 a4( 1.1 ); tQ4 b4( 1 ); tQ12 a12( 3.3 ); tQ12 b12( 3 ); tQ18 a18; double ad; double bd; tQ8 a8( -2.3 ); tQ8 b8( 2 ); tQ8 c8( Q8CONST( -2,3 ) ); tQ8 d8( a8 ); tQ8 e8( a4 ); // tQ8 f8( a12 ); // Warning: left shift count is negative tQ8 g8( a12.roundedTo< tQ8 >() ); tQ8 h8( a12.roundedTo< 8 >() ); // a8 = a4.roundedTo( h8 ); //Warning: left/right shift is negative a8 = 1; a8 = -2; a8 = 3; a8 = Q8CONST( 3,001 ); a8 = tQ8( 3.001 ); a8 = tQ8::truncated( 3.001 ); a8 = tQ8::rounded( 3.001 ); a8.setTruncated( 3.2 ); a8.setRounded( 3.3 ); a8 = tQ8( 123, 8 ); a8 = tQ8::create( 123 << 8 ); a8 = a4; a8 = a8; // a8 = a12; // Warning: left shift count is negative a8 = a12.roundedTo< tQ8 >(); a8 = a12.roundedTo( a8 ); a8.setRounded( a12 ); a8 = -a4; a8 = -a8; a8 += 3; a8 += 4u; a8 += 5l; a8 += 6lu; a8 += tQ8( 3.2 ); a8 += truncatedTo( a8, 3.3 ); a8 += roundedTo( a8, 3.4 ); a8 += a4; // a8 += a12; // Warning: left shift count is negative a8 += a12.roundedTo< tQ8 >(); a8 += a12.roundedTo( a8 ); a8 = a8 + 2; a8 = 3 + a8; a8 = a8 + a4; // a8 = a4 + a8; // Warning: left shift count is negative a8 -= 3; a8 -= 4u; a8 -= 5l; a8 -= 6lu; a8 -= roundedTo< tQ8::cQBits >( 3.2 ); a8 -= roundedTo( a8, 3.3 ); a8 -= a4; // a8 -= a12; // Warning: left shift count is negative a8 -= a12.roundedTo< tQ8 >(); a8 -= a12.roundedTo( a8 ); a8 = a8 - 2; a8 = 3 - a8; a8 = a8 - a4; // a8 = a4 - a8; // Warning: left shift count is negative a8 *= 3; a8 *= 4u; a8 *= 5l; a8 *= 6lu; // a8 *= 3.2; // Warning: converting to int from double a8 *= a4; a8 *= a12; a8 = a8 * 2; a8 = 3 * a8; a12 = a8 * a4; a12 = a4 * a8; a8 /= 3; a8 /= 4u; a8 /= 5l; a8 /= 6lu; // a8 /= 3.2; // Warning: converting to int from double a8 /= a4; // Note: possible overflow due to pre-shifting "(a8 << 4) / a4" // a8 /= a12; // Warning: left shift count is negative a8 = a8.increasedBy( a12 ) / a12; a8 = a8 / 2; // a8 = 3 / a8; // Error: no match for 'operator/' a8 = tQ16( 3 ) / a8; a12 = a8 / a4; a12 = a4 / a8; a8 == 3; a8 == 4u; a8 == 5l; a8 == 6lu; a8 == tQ8( 3.2 ); a8 == truncatedTo( a8, 3.3 ); a8 == roundedTo( a8, 3.4 ); a8 == a4; // a8 == a12; // Warning: left shift count is negative a8 == a12.roundedTo< tQ8 >(); a8 == a12.roundedTo( a8 ); 3 == a8; int(4u) == a8; int(5l) == a8; int(6lu) == a8; a8 < 3; a8 < 4u; a8 < 5l; a8 < 6lu; a8 < tQ8( 3.2 ); a8 < a4; // a8 < a12; // Warning: left shift count is negative 3 < a8; int(4u) < a8; int(5l) < a8; int(6lu) < a8; a8 > 3; a8 > 4u; a8 > 5l; a8 > 6lu; a8 > tQ8( 3.2 ); a8 > a4; // a8 > a12; // Warning: left shift count is negative 3 > a8; int(4u) > a8; int(5l) > a8; int(6lu) > a8; !a8; int intPart = a8.intPart(); int fracPart = a8.fracPart(); int fracPlaces = a8.fracPlaces( 3 ); unsigned abs = a8.absolute(); ad = a8.toDouble(); a8 = ad; // a8.set( ad ); // Warning: conversion from int to double, possible loss of data a8.setRounded( ad ); a8 = truncatedTo( a8, ad ); a8 = truncatedTo<8>( ad ); a8 = truncatedTo<tQ8>( ad ); // tBigQ36 aB36( 123567890 ); // Error: ambiguous tBigQ36 aB36( 123567890ll ); tBigQ36 bB36( a8 ); aB36 = tBigQ18( a18 ) * a18; }