示例#1
0
void DisplayOptionWidget::updateUI()
{
    PreferenceManager* prefs = editor()->preference();

    SignalBlocker b( ui->thinLinesButton );
    ui->thinLinesButton->setChecked( prefs->isOn( SETTING::INVISIBLE_LINES ) );
    
    SignalBlocker b2( ui->outLinesButton );
    ui->outLinesButton->setChecked( prefs->isOn( SETTING::OUTLINES ) );
    
    SignalBlocker b3( ui->onionPrevButton );
    ui->onionPrevButton->setChecked( prefs->isOn( SETTING::PREV_ONION ) );
    
    SignalBlocker b4( ui->onionNextButton );
    ui->onionNextButton->setChecked( prefs->isOn( SETTING::NEXT_ONION ) );
    
    SignalBlocker b5( ui->onionBlueButton );
    ui->onionBlueButton->setChecked( prefs->isOn( SETTING::ONION_BLUE ) );
    
    SignalBlocker b6( ui->onionRedButton );
    ui->onionRedButton->setChecked( prefs->isOn( SETTING::ONION_RED ) );
    
    SignalBlocker b7( ui->mirrorButton );
    ui->mirrorButton->setChecked( prefs->isOn( SETTING::MIRROR_H ) );
    
    SignalBlocker b8( ui->mirrorVButton );
    ui->mirrorVButton->setChecked( prefs->isOn( SETTING::MIRROR_V ) );
}
void testMod()
{
	BigData b1("-45353");
	BigData b2("37353753");
	BigData b3("-9223372036854775808");
	BigData b4(" 9223372036854775800");
	BigData b5("-9223372036854775810");
	BigData b6(" 9223372036854775900");
	BigData b7("-1231123203367738338252");

	//1、排除除数为0
	//cout << (b1 / BigData(0)) << endl;

	//2、在范围内

	cout << (b1 % b2) << endl;
	cout << (b2 % b1) << endl;


	//3、不在范围内<左(被除数)比右(除数)小为0,左比右大>
	cout << (b2 % b5) << endl;
	cout << (b2 % b6) << endl;

	cout << (b5 % b2) << endl;

	cout << (b6 % b2) << endl;
	cout << (b6 % b1) << endl;
	cout << (b5 % b1) << endl;

	cout << b7 % b1 << endl;
}
示例#3
0
void level_three()
{
	vector<DPipe> DirectPipes(13);
		vector<DoublePipe> DoublePipes(13);
		vector<CrossPipe> CrossPipes(2);
				DPipe a0(50,SCREEN_HEIGHT-50,100,40);
				DoublePipe b0(150,SCREEN_HEIGHT-50,70,40);
				DPipe a1(150,SCREEN_HEIGHT-150,100,40);
				DoublePipe b1(150,SCREEN_HEIGHT-250,70,40);
				DPipe a2(250,SCREEN_HEIGHT-350,100,40);
				DoublePipe b2(350,SCREEN_HEIGHT-250,70,40);
				DPipe a3(350,SCREEN_HEIGHT-350,100,40);
				DPipe a4(350,SCREEN_HEIGHT-150,100,40);
				DoublePipe b3(250,SCREEN_HEIGHT-450,70,40);
				DoublePipe b4(350,SCREEN_HEIGHT-450,70,40);
				CrossPipe c0(250,SCREEN_HEIGHT-250,100,40);
				DPipe a5(550,SCREEN_HEIGHT-50,100,40);
				DoublePipe b5(250,SCREEN_HEIGHT-150,70,40);
				DoublePipe b6(450,SCREEN_HEIGHT-50,70,40);
				DoublePipe b7(650,SCREEN_HEIGHT-150,70,40);
				DPipe a6(550,SCREEN_HEIGHT-50,100,40);
				DPipe a7(550,SCREEN_HEIGHT-150,100,40);
				DoublePipe b8(750,SCREEN_HEIGHT-50,70,40);
				DPipe a8(550,SCREEN_HEIGHT-250,100,40);
				DoublePipe b9(750,SCREEN_HEIGHT-350,70,40);
				CrossPipe c1(450,SCREEN_HEIGHT-150,100,40);
				DoublePipe b10(350,SCREEN_HEIGHT-450,70,40);
				DPipe a9(750,SCREEN_HEIGHT-150,100,40);
				DPipe a10(750,SCREEN_HEIGHT-250,100,40);
				DoublePipe b11(450,SCREEN_HEIGHT-250,70,40);
				DoublePipe b12(650,SCREEN_HEIGHT-250,70,40);
				DPipe a11(650,SCREEN_HEIGHT-50,100,40);
				DPipe a12(850,SCREEN_HEIGHT-350,100,40);

				DirectPipes[0] = a0; DoublePipes[0] = b0;
				DirectPipes[1] = a1; DoublePipes[1] = b1;
				DirectPipes[2] = a2; DoublePipes[2] = b2;
				DirectPipes[3] = a3; DoublePipes[3] = b3;
				DirectPipes[4] = a4; DoublePipes[4] = b4;
				DirectPipes[5] = a5; DoublePipes[5] = b5;
				DirectPipes[6] = a6; DoublePipes[6] = b6;
				DirectPipes[7] = a7; DoublePipes[7] = b7;
				DirectPipes[8] = a8; DoublePipes[8] = b8;
				DirectPipes[9] = a9; DoublePipes[9] = b9;
				DirectPipes[10] = a10; DoublePipes[10] = b10;
				DirectPipes[11] = a11; DoublePipes[11] = b11;
				DirectPipes[12] = a12; DoublePipes[12] = b12;
				CrossPipes[0] = c0; CrossPipes[1] = c1;
				Water a(20,SCREEN_HEIGHT-50,40,40);
}
示例#4
0
文件: Test.cpp 项目: momo462/Project
void test2()
{
	BigData b1("");
	BigData b2("-123");
	BigData b3("-");
	BigData b4("+");
	BigData b5("+aa123");
	BigData b6("-aa123");
	BigData b7("aa123");
	BigData b8("123");
	BigData b9("+12aa3");
	BigData b10("-12aa3");
	BigData b11("12aa3");
	BigData b13("-000123");
	BigData b14("+000123");
	BigData b15("9999999999999999999999999999999999999999999999999999999");
	BigData b16(123);
	BigData b17(1234);
	cout<<b15;
	cin>>b1;

}
示例#5
0
void level_one()
{
	vector<DPipe> DPIPES(5);
	vector<DoublePipe> DOUBPIPES(8);
	vector<CrossPipe> CROSSPIPES(1);

	DPipe a0(70,600,100,40);
	DPipe a1(170,600,100,40);
	DoublePipe b0(270,600,70,40);
	DoublePipe b1(270,500,70,40);
	DoublePipe b2(170,500,70,40);
	DoublePipe b3(170,400,70,40);
	DPipe a2(270,400,100,40);
	CrossPipe c0(370,400,100,40);
	DoublePipe b4(470,400,70,40);
	DoublePipe b5(470,300,70,40);
	DoublePipe b6(370,300,70,40);
	DoublePipe b7(370,500,70,40);
	DPipe a3(470,500,100,40);
	DPipe a4(570,500,100,40);

	DPIPES[0]=a0;
	DPIPES[1]=a1;
	DPIPES[2]=a2;
	DPIPES[3]=a3;
	DPIPES[4]=a4;

	DOUBPIPES[0]=b0;
	DOUBPIPES[1]=b1;
	DOUBPIPES[2]=b2;
	DOUBPIPES[3]=b3;
	DOUBPIPES[4]=b4;
	DOUBPIPES[5]=b5;
	DOUBPIPES[6]=b6;
	DOUBPIPES[7]=b7;

	CROSSPIPES[0]=c0;
}
void Test1()
{
	BigData n1(123456);

	BigData b2("12346678");
	BigData b3("+12346678");
	BigData b4("-123466");
	BigData b5("+");
	BigData b6("    ");
	BigData b7("12346aaaa");
	BigData b8("+asd12346678");
	BigData b9("000012346678");

	cout << "n1:" << n1 << endl;
	cout << "b2:" << b2 << endl;
	cout << "b3:" << b3 << endl;
	cout << "b4:" << b4 << endl;
	cout << "b5:" << b5 << endl;
	cout << "b6:" << b6 << endl;
	cout << "b7:" << b7 << endl;
	cout << "b8:" << b8 << endl;
	cout << "b9:" << b9 << endl;
}
示例#7
0
int main()
{
    // Några saker som ska fungera:
    UIntVector a(10);               // initiering med 7 element
    std::cout << "a(10)"<< a.length << std::endl;
    std::cout << "kopiering" << std::endl;
    UIntVector b(a);           // kopieringskonstruktor 
    std::cout << "kopiering" << std::endl;
    a = a;
    std::cout << "s**t" << std::endl;
    UIntVector c = a;          // kopieringskonstruktor 

    //Extra tester för alla Requirments
    a = b;                 // tilldelning genom kopiering
    a[5] = 7;              // tilldelning till element

    const UIntVector e(100000);    // konstant objekt med 10 element
    int i = e[5];          // const int oper[](int) const körs
    i = a[0];              // vektorn är nollindexerad
    i = a[5];              // int oper[](int) körs
    
    a[5]++;                // öka värdet till 8
    
    //Extra tester för alla Requirments
    std::cout << "(1)TEST" << std::endl;
    int aa = e[9];
    int ab = e[0];
    std::cout << "(1)S**T" << aa << ab << std::endl;


    std::cout << "(2)TEST" << std::endl;
    for(long int i = 0; i < 100000; i++)
    {
        e[i];
    } 
    std::cout << "(2)S**T" << std::endl;




    std::cout << "(3)TEST" << std::endl;
    UIntVector a3(10); UIntVector b3(0); UIntVector c3(0);
    b3 = a3;
    a3 = c3;
    std::cout << "(3)S**T" << std::endl;




    std::cout << "(4) START" << std::endl;
    std::initializer_list<unsigned int> list = {1,2,3};
    UIntVector a4(list); UIntVector b4(0);
    a4 = b4;
    std::cout << "length a" << a4.size() << "len b " << b4.size() << std::endl;
    std::cout << "(4) S**T" << std::endl;



    std::cout << "(5)TEST" << std::endl;
    UIntVector b5(list);
    UIntVector a5(std::move(b5));
    std::cout << "(5)S**T" << std::endl;





    std::cout << "(6)TEST" << std::endl;
    UIntVector a6(30);
    UIntVector b6(a6);
    std::cout << "(6)S**T" << std::endl;


    std::cout << "(7)TEST" << std::endl;
    UIntVector a7(1); 
    std::cout << "a) len innan " <<a7.length << std::endl;
    UIntVector b7(std::move(a7));
    std::cout << "b) len " <<b7.length << std::endl;
    std::cout << "a) len " <<a7.length << std::endl;
    std::cout << "(7)S**T" << std::endl;

    std::cout << "(8)TEST" << std::endl;
    UIntVector a8(10);
    a8.reset();
    UIntVector b8(11);
    std::cout << "a) INNAN len " <<a8.size() << "ptr " << a8.vector_ptr <<std::endl;
    UIntVector c8(std::move(a8));
    std::cout << "c) len " <<c8.size() << "ptr" << c8.vector_ptr <<std::endl;
    std::cout << "a) len " <<a8.size() << "ptr " << a8.vector_ptr <<std::endl;
    std::cout << "(8)S**T" << std::endl;


    std::cout << "(9)TEST COPY TO SELF" << std::endl;
    b8 = b8;
    std::cout << "(9)S**T" << std::endl;
    try {
        i = e[10];             // försöker hämta element som ligger utanför e
    } catch (std::out_of_range e) {
        std::cout << e.what() << std::endl;
    }

    
#if 0
    // Diverse saker att testa
    e[5] = 3;              // fel: (kompilerar ej) tilldelning till const
    b = b;                 // hmm: se till att inte minnet som skall behållas frigörs
#endif

    return 0;
}
示例#8
0
int main ()
{
    A7<1> a7;
    B7<1> b7(73);
    a7.a = 10;
    a7.b = 11;
    a7.foo();
    // b7.a = 10;
    b7.b[0] = 11;
    b7.b[100] = 12;
    // b7.foo();
    // b7.bar();
    printf("%d\n", b7.a);




    // B10 b10;
    // C10 c10;
    // foo10(b10);
    // foo10(c10);
    // int i10 = 10;
    // A9 a9;
    // b10.bar(i10);
    // arr<vec<st>, 2> arr1;
    // arr1[0].push_back(0.0);
    // arr1[1].push_back(1.0);
    // arr1[1].push_back(2.0);
    // arr<vec<st>, 2> arr2(arr1);
    // printf("%ld %ld %ld\n", arr2[0][0], arr2[1][0], arr2[1][1]);

    // A5 a5;
    // A6<1,2> a6;
    // a6.foo();
    // printf("%ld\n", 10_plus(20_plus(30)));
    // int a = 10;
    // printf("%d\n", a);
    // printf("%d\n", a++);
    // printf("%d\n", ++a);
    // printf("%d\n", a);
    // B4 b4; 
    // C4<2> c4;
    // std::cout << foo4(c4) << std::endl;
    // B2 b2;
    // b2.foo() = 10;
    // B1 b1;
    // b1 = b2;
    // A1 a1;
    // a1.foo() = 20;
    // assemble_matrix(1, A1());

    // A3 a3(10);
    // std::cout << a3.a << std::endl;
    // puts("1");
    // A3(11);
    // std::cout << A3(12).a << std::endl;
    // puts("2");
    // A a;
    // B b;
    // a.f1();
    // a.f2();
    // a.f3();
    // b.f1();
    // b.f2();
    // b.f3();

    // O o;
    // o.i = 10;
    // o.j = 20;
    // P p;
    // p.i = 30.0;
    // p.j = 0;
    // p.p().j = 10;

    // // printf("%ld %d %d\n",sizeof(p), *((char*)(&o))+0, p.i);
    // printf("%ld %ld\n", sizeof(o.i), sizeof(p.i));
    // printf("%ld %ld\n", sizeof(o), sizeof(p));
    // printf("%d\n", p.j);
    // printf("%ld %ld\n", sizeof(p.i), sizeof(p.p().i));
    // printf("%d %d\n", p.i, p.p().i);

    // // typeof(o.i);

    // C c;
    // D d(10);
    // c.foo();
    // d.foo();
    // printf("%d %d\n", c.a, d.a);

    // // printf("%d\n", St::f1());
    // printf("%ld %ld %ld\n", sizeof(float), sizeof(double), sizeof(long double));

    return 0;
}
示例#9
0
文件: main.cpp 项目: murak/BigInteger
int main() {
    /* test cases */

    /*
    * case 1: addition a>b and b>a and a=b 
    */
    BigInt a1("99");
    BigInt b1("9131");
    std::cout<<"\na = "<<a1.toString();
    std::cout<<"\nb = "<<b1.toString();
    std::cout<<"\nsum = "<<(a1+b1).toString();
    std::cout<<"\na-b = "<<(a1-b1).toString();

    BigInt a2("99");
    BigInt b2("91");
    std::cout<<"\na = "<<a2.toString();
    std::cout<<"\nb = "<<b2.toString();
    std::cout<<"\nsum = "<<(a2+b2).toString();
    std::cout<<"\nproduct = "<<(a2*b2).toString();
    std::cout<<"\na-b = "<<(a2-b2).toString();

    /*
    * case 2: a=b and one is negative
    */
    BigInt a3("-99");
    BigInt b3("91");
    std::cout<<"\na = "<<a3.toString();
    std::cout<<"\nb = "<<b3.toString();
    std::cout<<"\nsum = "<<(a3+b3).toString();
    std::cout<<"\nsum = "<<(b3+a3).toString();
    std::cout<<"\nproduct = "<<(b3*a3).toString();
    std::cout<<"\na-b = "<<(a3-b3).toString();

    /*
    * case 2: abs(a)>abs(b) and a is negative
    */
    BigInt a4("-999");
    BigInt b4("91");
    std::cout<<"\na = "<<a4.toString();
    std::cout<<"\nb = "<<b4.toString();
    std::cout<<"\nsum = "<<(a4+b4).toString();
    std::cout<<"\nsum = "<<(b4+a4).toString();
    std::cout<<"\nproduct = "<<(b4*a4).toString();
    std::cout<<"\na-b = "<<(a4-b4).toString();

    /*
    * case 3: abs(b)>abs(a) and b is negative
    */
    BigInt a5("99");
    BigInt b5("-991");
    std::cout<<"\na = "<<a5.toString();
    std::cout<<"\nb = "<<b5.toString();
    std::cout<<"\nsum = "<<(a5+b5).toString();
    std::cout<<"\nsum = "<<(b5+a5).toString();
    std::cout<<"\nproduct = "<<(b5*a5).toString();
    std::cout<<"\na-b = "<<(a5-b5).toString();

    /*
    * case 4: abs(b)>abs(a) and a,b is negative
    */
    BigInt a6("-99");
    BigInt b6("-991");
    std::cout<<"\na = "<<a6.toString();
    std::cout<<"\nb = "<<b6.toString();
    std::cout<<"\nsum = "<<(a6+b6).toString();
    std::cout<<"\nsum = "<<(b6+a6).toString();
    std::cout<<"\na-b = "<<(a6-b6).toString();

    /*
    * case 4: abs(b)=abs(a) and a,b is negative
    */
    BigInt a7("-999");
    BigInt b7("-991");
    std::cout<<"\na = "<<a7.toString();
    std::cout<<"\nb = "<<b7.toString();
    std::cout<<"\nsum = "<<(a7+b7).toString();
    std::cout<<"\nsum = "<<(b7+a7).toString();
    std::cout<<"\nproduct = "<<(b7*a7).toString();
    std::cout<<"\na-b = "<<(a7-b7).toString();

    /*
    * case 5: a-b
    */
    BigInt a8("-999");
    BigInt b8("-991");
    std::cout<<"\na = "<<a8.toString();
    std::cout<<"\nb = "<<b8.toString();
    std::cout<<"\na-b = "<<(a8-b8).toString();
    std::cout<<"\na-b = "<<(a8-b8).toString();



    BigInt fact("1");
    clock_t time = clock();
    fact = fact.factorial(1000);
    time = clock() - time;
    std::cout<<"\n\n10000 Factorial:\n"<<fact.toString()<<std::endl;
    std::cout<<"\n\ntime taken to find 1000! = "<<time/CLOCKS_PER_SEC<<" seconds";

    BigInt rd;
    rd = rd.random();
    std::cout<<"\n\n\nRandom number = "<<rd.toString()<<"\n\n";

    rd = rd.random();
    std::cout<<"\n\n\nRandom number = "<<rd.toString()<<"\n\n";

    rd = rd.random();
    std::cout<<"\n\n\nRandom number = "<<rd.toString()<<"\n\n";

    return 0;
}
示例#10
0
TEST(CollisionTest, CollisionTestAll)
{
    int a_x = 10;
    int a_y = 10;
    int a_width = 10;
    int a_height = 10;

    int b1_x = 10;
    int b1_y = 30;
    int b1_width = 10;
    int b1_height = 10;

    int b2_x = 10;
    int b2_y = 20;
    int b2_width = 10;
    int b2_height = 1;

    int b3_x = 20;
    int b3_y = 10;
    int b3_width = 1;
    int b3_height = 10;

    int b4_x = 30;
    int b4_y = 10;
    int b4_width = 10;
    int b4_height = 10;

    int b5_x = 30;
    int b5_y = 30;
    int b5_width = 10;
    int b5_height = 10;

    int b6_x = 9;
    int b6_y = 10;
    int b6_width = 1;
    int b6_height = 10;

    int b7_x = 10;
    int b7_y = 9;
    int b7_width = 10;
    int b7_height = 1;

    int b8_x = 10;
    int b8_y = 10;
    int b8_width = 10;
    int b8_height = 10;

    int b9_x = 10;
    int b9_y = 15;
    int b9_width = 10;
    int b9_height = 5;

    int b10_x = 13;
    int b10_y = 13;
    int b10_width = 2;
    int b10_height = 2;

    int b11_x = 18;
    int b11_y = 2;
    int b11_width = 10;
    int b11_height = 10;

    int b12_x = 5;
    int b12_y = 15;
    int b12_width = 10;
    int b12_height = 10;

    BoxShape a(a_x, a_y, a_width, a_height);
    BoxShape b1(b1_x, b1_y, b1_width, b1_height);
    BoxShape b2(b2_x, b2_y, b2_width, b2_height);
    BoxShape b3(b3_x, b3_y, b3_width, b3_height);
    BoxShape b4(b4_x, b4_y, b4_width, b4_height);
    BoxShape b5(b5_x, b5_y, b5_width, b5_height);
    BoxShape b6(b6_x, b6_y, b6_width, b6_height);
    BoxShape b7(b7_x, b7_y, b7_width, b7_height);
    BoxShape b8(b8_x, b8_y, b8_width, b8_height);
    BoxShape b9(b9_x, b9_y, b9_width, b9_height);
    BoxShape b10(b10_x, b10_y, b10_width, b10_height);
    BoxShape b11(b11_x, b11_y, b11_width, b11_height);
    BoxShape b12(b12_x, b12_y, b12_width, b12_height);

    ASSERT_FALSE(collision_detection(a, b1)) << "Should not return collision. They are apart";
    ASSERT_FALSE(collision_detection(a, b2)) << "Should not return collision. They are adjacent";
    ASSERT_FALSE(collision_detection(a, b3)) << "Should not return collision. They are adjacent";
    ASSERT_FALSE(collision_detection(a, b4)) << "Should not return collision. They are apart";
    ASSERT_FALSE(collision_detection(a, b5)) << "Should not return collision. They are apart";
    ASSERT_FALSE(collision_detection(a, b6)) << "Should not return collision. They are adjacent";
    ASSERT_FALSE(collision_detection(a, b7)) << "Should not return collision. They are adjacent";
    ASSERT_TRUE(collision_detection(a, b8)) << "Should return collision. They are on top of each other";
    ASSERT_TRUE(collision_detection(a, b9)) << "Should return collision. They intersect";
    ASSERT_TRUE(collision_detection(a, b10)) << "Should return collision. One is inside the other";
    ASSERT_TRUE(collision_detection(a, b11)) << "Should return collision. They intersect";
    ASSERT_TRUE(collision_detection(a, b12)) << "Should return collision. They intersect";
}
/**
@SYMTestCaseID			SYSLIB-SQL-CT-1628
@SYMTestCaseDesc		GetFirstSqlStmt() test
						Tests the GetFirstSqlStmt() behaviour with a set of various SQL statements.
@SYMTestPriority		High
@SYMTestActions			GetFirstSqlStmt() test
@SYMTestExpectedResults Test must not fail
@SYMREQ					REQ5792
                        REQ5793
*/	
void TestGetFirstSqlStmt()
	{
	TPtrC res;

	TBuf<1> b2; b2.Append(TChar(0));
	TPtr p2(PTR_ARG(b2));
	res.Set(GetFirstSqlStmt(p2));
	//Expected result: res = "\x0", p2 is NULL
	TEST(res == b2);
	TEST(!p2.Ptr());
		
	TBuf<2> b3; b3.Append(TChar(' ')); b3.Append(TChar(0));
	TPtr p3(PTR_ARG(b3));
	res.Set(GetFirstSqlStmt(p3));
	//Expected result: res = " \x0", p3 is NULL
	TEST(res == b3);
	TEST(!p3.Ptr());
	
	TBuf<7> b4(_L(";; ;  ")); b4.Append(TChar(0));
	TPtr p4(PTR_ARG(b4));
	res.Set(GetFirstSqlStmt(p4));
	//Expected result: res = "\x0", p4 = "; ;  \x0"
	TEST(res.Length() == 1 && (TInt)res[0] == 0);
	TInt accLen = res.Length();
	TEST(p4 == b4.Right(b4.Length() - accLen));

	res.Set(GetFirstSqlStmt(p4));
	//Expected result: res = "\x0", p4 = " ;  \x0"
	TEST(res.Length() == 1 && (TInt)res[0] == 0);
	accLen += res.Length();
	TEST(p4 == b4.Right(b4.Length() - accLen));
	
	res.Set(GetFirstSqlStmt(p4));
	//Expected result: res = " \x0", p4 = "  \x0"
	TEST((TInt)res[0] == (TInt)TChar(' ') && (TInt)res[1] == 0);
	accLen += res.Length();
	TEST(p4 == b4.Right(b4.Length() - accLen));
	
	res.Set(GetFirstSqlStmt(p4));
	//Expected result: res = "  \x0", p4 is NULL
	TEST((TInt)res[0] == (TInt)TChar(' ') && (TInt)res[1] == (TInt)TChar(' ') && (TInt)res[2] == 0);
	TEST(!p4.Ptr());
	
	TBuf<20> b5(_L("SELECT * FROM A")); b5.Append(TChar(0));
	TPtr p5(PTR_ARG(b5));
	res.Set(GetFirstSqlStmt(p5));
	//Expected result: res = "SELECT * FROM A\x0", p5 is NULL
	TEST(res == b5);
	TEST(!p5.Ptr());
	
	TBuf<20> b6(_L("SELECT * FROM A;")); b6.Append(TChar(0));
	TPtr p6(PTR_ARG(b6));
	res.Set(GetFirstSqlStmt(p6));
	//Expected result: res = "SELECT * FROM A\x0", p6 = "\x0"
	TEST(res == b6.Left(b6.Length() - 1));
	TEST(p6.Length() == 1 && p6[0] == 0);

	TBuf<40> b7(_L("/** Comment */ SELECT * FROM A;")); b7.Append(TChar(0));
	TPtr p7(PTR_ARG(b7));
	res.Set(GetFirstSqlStmt(p7));
	//Expected result: res = "/** Comment */ SELECT * FROM A\x0", p7 = "\x0"
	TEST(res == b7.Left(b7.Length() - 1));
	TEST(p7.Length() == 1 && p7[0] == 0);

	TBuf<40> b8(_L(" SELECT * FROM --Comment \r\n A;")); b8.Append(TChar(0));
	TPtr p8(PTR_ARG(b8));
	res.Set(GetFirstSqlStmt(p8));
	//Expected result: res = " SELECT * FROM --Comment \r\n A\x0", p8 = "\x0"
	TEST(res == b8.Left(b8.Length() - 1));
	TEST(p8.Length() == 1 && p8[0] == 0);

	TBuf<40> b9(_L("SELECT * FROM A; SELECT * FROM B")); b9.Append(TChar(0));
	TPtr p9(PTR_ARG(b9));
	res.Set(GetFirstSqlStmt(p9));
	//Expected result: res = "SELECT * FROM A\x0", p9 = " SELECT * FROM B\x0"
	TEST(res.Left(res.Length() - 1) == b9.Left(res.Length() - 1) && (TInt)res[res.Length() - 1] == 0);
	accLen = res.Length();
	TEST(p9 == b9.Right(b9.Length() - accLen));

	res.Set(GetFirstSqlStmt(p9));
	//Expected result: res = " SELECT * FROM B\x0", p9 is NULL
	TEST(res == b9.Right(b9.Length() - accLen));
	TEST(!p9.Ptr());

	//Defect INC113060	
	TBuf<255> b10(_L("UPDATE Playlist SET Name=';',Time='2007-09-20 12:31:33' WHERE UniqueId=640397473"));
	TPtr p10(PTR_ARG(b10));
	res.Set(GetFirstSqlStmt(p10));
	//Expected results: res= original string
	TEST(res.Compare(b10)==0);
	TEST(!p10.Ptr());
	
	TBuf<255> firstStmt(_L("SELECT * FROM PlayList"));firstStmt.Append(TChar(0));
	TBuf<255> b11(_L("SELECT * FROM PlayList;UPDATE Playlist SET Name=';',Time='2007-09-20 12:31:33' WHERE UniqueId=640397473"));
	TPtr p11(PTR_ARG(b11));
	res.Set(GetFirstSqlStmt(p11));
	TEST(res.Compare(firstStmt)==0);
	TEST(p11.Compare(b10)==0);
	}
示例#12
0
void level_two()
{
		vector<DPipe> DPIPES(44);
	vector<DoublePipe> DOUBPIPES(18);
	vector<CrossPipe> CROSSPIPES(3);

	DPipe background(600,400,1200,800);

	DPipe a0(50,750,100,40);
	DPipe a1(150,650,100,40);
	DPipe a2(150,550,100,40);
	DPipe a3(650,450,100,40);
	DPipe a4(550,550,100,40);
	DPipe a5(450,350,100,40);
	DPipe a6(550,250,100,40);
	DPipe a7(650,250,100,40);
	DPipe a8(750,350,100,40);
	DPipe a9(750,450,100,40);
	DPipe a10(750,550,100,40);
	DPipe a11(650,650,100,40);
	DPipe a12(550,650,100,40);
	DPipe a13(450,650,100,40);
	DPipe a14(350,550,100,40);
	DPipe a15(350,350,100,40);
	DPipe a16(350,250,100,40);
	DPipe a17(450,150,100,40);
	DPipe a18(550,150,100,40);
	DPipe a19(650,150,100,40);
	DPipe a20(750,150,100,40);
	DPipe a21(850,250,100,40);
	DPipe a22(850,350,100,40);
	DPipe a23(850,450,100,40);
	DPipe a24(850,550,100,40);
	DPipe a25(850,650,100,40);
	DPipe a26(750,750,100,40);
	DPipe a27(650,750,100,40);
	DPipe a28(550,750,100,40);
	DPipe a29(450,750,100,40);
	DPipe a30(350,750,100,40);
	DPipe a31(250,650,100,40);
	DPipe a32(250,550,100,40);
	DPipe a33(250,350,100,40);
	DPipe a34(250,250,100,40);
	DPipe a35(250,150,100,40);
	DPipe a36(350,50,100,40);
	DPipe a37(450,50,100,40);
	DPipe a38(550,50,100,40);
	DPipe a39(650,50,100,40);
	DPipe a40(750,50,100,40);
	DPipe a41(850,50,100,40);
	DPipe a42(950,150,100,40);
	DPipe a43(950,250,100,40);

	DoublePipe b0(150,750,70,40);
	DoublePipe b1(150,450,70,40);
	DoublePipe b2(550,450,70,40);
	DoublePipe b3(550,350,70,40);
	DoublePipe b4(650,350,70,40);
	DoublePipe b5(650,550,70,40);
	DoublePipe b6(450,550,70,40);
	DoublePipe b7(450,250,70,40);
	DoublePipe b8(750,250,70,40);
	DoublePipe b9(750,650,70,40);
	DoublePipe b10(350,650,70,40);
	DoublePipe b11(350,150,70,40);
	DoublePipe b12(850,150,70,40);
	DoublePipe b13(850,750,70,40);
	DoublePipe b14(250,750,70,40);
	DoublePipe b15(250,50,70,40);
	DoublePipe b16(950,50,70,40);
	DoublePipe b17(950,350,70,40);

	CrossPipe c0(250,450,100,40);
	CrossPipe c1(350,450,100,40);
	CrossPipe c2(450,450,100,40);

	DPIPES[0]=a0;
	DPIPES[1]=a1;
	DPIPES[2]=a2;
	DPIPES[3]=a3;
	DPIPES[4]=a4;
	DPIPES[5]=a5;
	DPIPES[6]=a6;
	DPIPES[7]=a7;
	DPIPES[8]=a8;
	DPIPES[9]=a9;
	DPIPES[10]=a10;
	DPIPES[11]=a11;
	DPIPES[12]=a12;
	DPIPES[13]=a13;
	DPIPES[14]=a14;
	DPIPES[15]=a15;
	DPIPES[16]=a16;
	DPIPES[17]=a17;
	DPIPES[18]=a18;
	DPIPES[19]=a19;
	DPIPES[20]=a20;
	DPIPES[21]=a21;
	DPIPES[22]=a22;
	DPIPES[23]=a23;
	DPIPES[24]=a24;
	DPIPES[25]=a25;
	DPIPES[26]=a26;
	DPIPES[27]=a27;
	DPIPES[28]=a28;
	DPIPES[29]=a29;
	DPIPES[30]=a30;
	DPIPES[31]=a31;
	DPIPES[32]=a32;
	DPIPES[33]=a33;
	DPIPES[34]=a34;
	DPIPES[35]=a35;
	DPIPES[36]=a36;
	DPIPES[37]=a37;
	DPIPES[38]=a38;
	DPIPES[39]=a39;
	DPIPES[40]=a40;
	DPIPES[41]=a41;
	DPIPES[42]=a42;
	DPIPES[43]=a43;

	DOUBPIPES[0]=b0;
	DOUBPIPES[1]=b1;
	DOUBPIPES[2]=b2;
	DOUBPIPES[3]=b3;
	DOUBPIPES[4]=b4;
	DOUBPIPES[5]=b5;
	DOUBPIPES[6]=b6;
	DOUBPIPES[7]=b7;
	DOUBPIPES[8]=b8;
	DOUBPIPES[9]=b9;
	DOUBPIPES[10]=b10;
	DOUBPIPES[11]=b11;
	DOUBPIPES[12]=b12;
	DOUBPIPES[13]=b13;
	DOUBPIPES[14]=b14;
	DOUBPIPES[15]=b15;
	DOUBPIPES[16]=b16;
	DOUBPIPES[17]=b17;

	CROSSPIPES[0]=c0;
	CROSSPIPES[1]=c1;
	CROSSPIPES[2]=c2;
}
示例#13
0
void ColorInspector::setColor(QColor newColor)
{
    // this is a UI update function, never emit any signals
    // grab the color from color manager, and then update itself, that's it.

    // compare under the same color spec
    newColor = (isRgbColors) ? newColor.toRgb() : newColor.toHsv();

    if (newColor == mCurrentColor)
    {
        return;
    }

    if(isRgbColors)
    {
        QSignalBlocker b1(ui->red_slider); 
        QSignalBlocker b2(ui->green_slider);
        QSignalBlocker b3(ui->blue_slider);
        QSignalBlocker b4(ui->alpha_slider);

        ui->red_slider->setRgb(newColor);
        ui->green_slider->setRgb(newColor);
        ui->blue_slider->setRgb(newColor);
        ui->alpha_slider->setRgb(newColor);

        QSignalBlocker b5(ui->RedspinBox);
        QSignalBlocker b6(ui->GreenspinBox);
        QSignalBlocker b7(ui->BluespinBox);
        QSignalBlocker b8(ui->AlphaspinBox);

        ui->RedspinBox->setValue(newColor.red());
        ui->GreenspinBox->setValue(newColor.green());
        ui->BluespinBox->setValue(newColor.blue());
        ui->AlphaspinBox->setValue(newColor.alpha());
    }
    else
    {
        QSignalBlocker b1(ui->red_slider);
        QSignalBlocker b2(ui->green_slider);
        QSignalBlocker b3(ui->blue_slider);
        QSignalBlocker b4(ui->alpha_slider);

        ui->red_slider->setHsv(newColor);
        ui->green_slider->setHsv(newColor);
        ui->blue_slider->setHsv(newColor);
        ui->alpha_slider->setHsv(newColor);

        QSignalBlocker b5(ui->RedspinBox);
        QSignalBlocker b6(ui->GreenspinBox);
        QSignalBlocker b7(ui->BluespinBox);
        QSignalBlocker b8(ui->AlphaspinBox);

        ui->RedspinBox->setValue(newColor.hsvHue());
        ui->GreenspinBox->setValue(qRound(newColor.hsvSaturation() / 2.55));
        ui->BluespinBox->setValue(qRound(newColor.value() / 2.55));
        ui->AlphaspinBox->setValue(qRound(newColor.alpha() / 2.55));
    }

    mCurrentColor = newColor;

    QPalette p1 = ui->colorWrapper->palette(), p2 = ui->color->palette();
    p1.setBrush(QPalette::Background, QBrush(QImage(":/background/checkerboard.png")));
    p2.setColor(QPalette::Background, mCurrentColor);
    ui->colorWrapper->setPalette(p1);
    ui->color->setPalette(p2);

    update();
}
示例#14
0
int main(int argc, char **argv) {

  //std::cout << "bit<64,4> is pod: " << std::is_pod< bit<64,4> >::value << std::endl;
  //std::cout << "cellset<4> is pod: " << std::is_pod< cellset<4> >::value << std::endl;
  std::cout << "All: " << cellset<4>::universe() << " : " << cellset<4>::universe().to_ullong() << std::endl;
  // std::cout << "Top: " << StandardSets<4>::top << " : " << StandardSets<4>::top.to_ullong() << std::endl;
  // std::cout << "Bottom: " << StandardSets<4>::bottom << " : " << StandardSets<4>::bottom.to_ullong() << std::endl;
  // std::cout << "Left: " << StandardSets<4>::left << " : " << StandardSets<4>::left.to_ullong() << std::endl;
  // std::cout << "Right: " << StandardSets<4>::right << " : " << StandardSets<4>::right.to_ullong() << std::endl;
  Board<4> b(R"(
      - - - -
       - - X O
        - O O O
         O O O O)");
  std::cout << b;
  b.MappedRender(std::cout, "", {{'*', b.verticalCells().neighbors()}});

  Board<7> b7(R"(
      X - - - - - X
       - - - - - - -
        - - - - - - -
         - - - X - - -
          - - - - - - -
           - - - - - - -
            X - - - - - X)");
  std::cout << b7;
  std::cout << b7.verticalCells() << std::endl;
  auto n = b7.verticalCells().neighbors();
  b7.MappedRender(std::cout, "", {{'*', n}});
  //std::cout << n << std::endl;


  Board<11> b11(R"(
      X - - - - - - - - - X
       - - - - - X - - - - -
        - - - - - - - - - - -
         - - - - - - - - - - -
          - - - - - - - - - - -
           - X - - - X - - - X -
            - - - - - - - - - - -
             - - - - - - - - - - -
              - - - - - - - - - - -
               - - - - - X - - - - -
                X - - - - - - - - - X)");
  std::cout << b11;
  auto n11 = b11.verticalCells().neighbors();
  b11.MappedRender(std::cout, "", {{'*', n11}});
  //std::cout << n11 << std::endl;

  b11 = Board<11>(R"(
      - - - - - X - - - - -
       - - - - - - - - - - -
        - - - - - - - - - - -
         - - - - - - - - - - -
          X - - - - - - - - - -
           - - - - - X - - - - -
            - - - - - - - - - - X
             - - - - - - - - - - -
              - - - - - - - - - - -
               - - - - - - - - - - -
                - - - - - X - - - - -)");
  std::cout << b11;
  // auto s11 = b11.topRow();
  // b11.MappedRender(std::cout, "", {{'*', s11}});
  // s11 = b11.bottomRow();
  // b11.MappedRender(std::cout, "", {{'*', s11}});
  // s11 = b11.leftColumn();
  // b11.MappedRender(std::cout, "", {{'*', s11}});
  // s11 = b11.rightColumn();
  // b11.MappedRender(std::cout, "", {{'*', s11}});
  b11.MappedRender(std::cout, "", {{'*', b11.verticalCells().neighbors()}});
  // //std::cout << n11 << std::endl;

  // Board<1>::MappedRender(std::cout, "", {{'*', Board<1>::leftColumn()}});
  // Board<2>::MappedRender(std::cout, "", {{'*', Board<2>::leftColumn()}});
  // Board<3>::MappedRender(std::cout, "", {{'*', Board<3>::leftColumn()}});
  // Board<4>::MappedRender(std::cout, "", {{'*', Board<4>::leftColumn()}});
  // Board<5>::MappedRender(std::cout, "", {{'*', Board<5>::leftColumn()}});
  // Board<6>::MappedRender(std::cout, "", {{'*', Board<6>::leftColumn()}});
  // Board<7>::MappedRender(std::cout, "", {{'*', Board<7>::leftColumn()}});
  // Board<8>::MappedRender(std::cout, "", {{'*', Board<8>::leftColumn()}});
  // Board<9>::MappedRender(std::cout, "", {{'*', Board<9>::leftColumn()}});
  // Board<10>::MappedRender(std::cout, "", {{'*', Board<10>::leftColumn()}});
  // Board<11>::MappedRender(std::cout, "", {{'*', Board<11>::leftColumn()}});
  // Board<12>::MappedRender(std::cout, "", {{'*', Board<12>::leftColumn()}});
  // Board<13>::MappedRender(std::cout, "", {{'*', Board<13>::leftColumn()}});
  // 
  // std::cout << 1 << ": " << shared_bits<64,1>::left() << std::endl;
  // std::cout << 2 << ": " << shared_bits<64,2>::left() << std::endl;
  // std::cout << 3 << ": " << shared_bits<64,3>::left() << std::endl;
  // std::cout << 4 << ": " << shared_bits<64,4>::left() << std::endl;
  // std::cout << 5 << ": " << shared_bits<64,5>::left() << std::endl;
  // std::cout << 6 << ": " << shared_bits<64,6>::left() << std::endl;
  // std::cout << 7 << ": " << shared_bits<64,7>::left() << std::endl;
  // std::cout << 8 << ": " << shared_bits<64,8>::left() << std::endl;
  // std::cout << 9 << ": " << shared_bits<128,9>::left() << std::endl;
  // std::cout << 10 << ": " << shared_bits<128,10>::left() << std::endl;
  // std::cout << 11 << ": " << shared_bits<128,11>::left() << std::endl;
  // std::cout << 12 << ": " << shared_bits<192,12>::left() << std::endl;
  // std::cout << 13 << ": " << shared_bits<192,13>::left() << std::endl;

  auto b13 = Board<13>(R"(
      X X - - - X - - - - - - -
       X - - - - - - - - - X - -
        - - - - - - - - - - X - -
         - - - - - - - - - - X - -
          X - - - - - - - - - - - -
           - - - - - - X - - - - - -
            - - - - - - - - - - - - X
             - - - - - - - - - - - - -
              - - - - - - - - - - - - -
               - - - - - - - - - - - - -
                - - - - - - - - - - - - -
                 - X X X - - - - - - - - X
                  - - - - - - - X - - - - X)");
  std::cout << b13;
  b13.MappedRender(std::cout, "", {{'*', b13.verticalCells().neighbors()}});
  return 0;
}