Exemplo n.º 1
0
	void testInvalidUrl()
	{
		QStringList invalid;
		invalid << "dinges:";
		invalid << "magnet:?xt=dinges";
		invalid << "magnet:?xt=urn:btih:fe377e017ef52ef";
		invalid << "magnet:?xt=urn:btih:fe377e017ef52efa83251231b5b991ffae0e77--";
		
		foreach (const QString & data,invalid)
		{
			bt::MagnetLink mlink(data);
			QVERIFY(!mlink.isValid());
		}
Exemplo n.º 2
0
int main(int argc, char** argv){
	int noOfRows = 5;
	int noOfCols = 1000;
	int love = 0;

	if(argc > 1){
		noOfCols = getNoOfColsForMB(atoi(argv[1]));
	}
	if(argc > 2){
		love = atoi(argv[2]);
		
	}
	if(argc > 3){
		noOfRows = atoi(argv[3]);
	}


	double **rows = malloc(sizeof(double*) * noOfRows);
	for(int c = 0; c < noOfRows; c++){
		rows[c] = malloc(sizeof(double) * noOfCols);
		
		for(int d = 0; d < noOfCols; d++){
			rows[c][d] = getRandomNumber();
		}
	}

	struct timeval start;
	struct timeval stop;
	struct timeval difference;

	gettimeofday(&start, NULL);


	double totalSum = 0.0;
	int cids[2];
	int ptr = 0;

	if(love){
		cids[0] = mchain();
		cids[1] = mchain();
	}

	for(int row = 1; row < noOfRows -1; row++){
		
		if(love){
			brk_mchain(cids[ptr]);

			if(row > 1){
				hate(rows[row - 2], noOfCols*sizeof(double));
			}

			mlink(cids[ptr], rows[row], noOfCols*sizeof(double));

			ptr += 1;
			ptr = ptr%2;
		}


		for(int col = 1; col < noOfCols -1; col++){

			double sum = 0.0;
			for(int i = -1; i < 2; i++){
				for(int j = -1; j < 2; j++){
					sum += rows[row + i][col + j] * (1.0/9.0);
				}
			}
			rows[row][col] = sum;
			totalSum += sum;
		}
	}

	gettimeofday(&stop, NULL);

	time_difference(&difference, &stop, &start);

    printf("Done.\n");
    printf("Time: %ds %dus\n", difference.tv_sec, difference.tv_usec);

	return 0;

}