void IsbnTest::testIsbn13_data() { QTest::addColumn<QString>("string"); QTest::addColumn<QString>("expectedIsbn"); QTest::newRow("0-06-087298-5") << QL1("0-06-087298-5") << QL1("978-0-06-087298-4"); QTest::newRow("9780-06-087298-4") << QL1("9780-06-087298-4") << QL1("978-0-06-087298-4"); }
void LccnTest::testValidation_data() { QTest::addColumn<QString>("string"); QTest::addColumn<QValidator::State>("state"); QTest::newRow("89-456") << QL1("89-456") << QValidator::Acceptable; QTest::newRow("2001-1114") << QL1("2001-1114") << QValidator::Acceptable; QTest::newRow("gm 71-2450") << QL1("gm 71-2450") << QValidator::Acceptable; }
void EntityTest::testEntities_data() { QTest::addColumn<QByteArray>("data"); QTest::addColumn<QString>("expectedString"); QTest::newRow("robby") << QByteArray("robby") << QL1("robby"); QTest::newRow("&fake;") << QByteArray("&fake;") << QL1("&fake;"); QTest::newRow("0") << QByteArray("0") << QL1("0"); QTest::newRow("robby0robb") << QByteArray("robby0robby") << QL1("robby0robby"); }
/*SUBROUTINE Eigen1*/ void Eigen1(int size, double *Freq, double ***D) { //DECLARE LOCAL VARIABLES int i, j, n; void Householder1(double ***a, int n, double *d, double *e); void QL1(double *d, double *e, int size, double ***a); double *e, *d; double swap, trial; //ALLOCATE MEMORY e = (double*) calloc(size, sizeof(double)); d = (double*) calloc(size, sizeof(double)); //CALL SUBROUTINES Householder1(D, size, d, e); QL1(d, e, size, D); //ORDER EIGENVALUES FROM LARGEST TO SMALLEST for(i=0;i<size;i++) { swap = d[i]; n = i; for(j=i+1;j<size;j++) { trial = d[j]; if(swap<trial) {swap=trial;n=j;} } if(n!=i) { d[n] = d[i]; d[i] = swap; /*#if defined EIGENVECTOR for(j=0;j<size;j++) { swap = D[j][i][0]; D[j][i][0] = D[j][n][0]; D[j][n][0] = swap; swap = D[j][i][1]; D[j][i][1] = D[j][n][1]; D[j][n][1] = swap; } #endif*/ } Freq[i] = d[i]; } //FREE DYNAMIC ARRAYS free(e); free(d); return; }
void LccnTest::testFormalization_data() { QTest::addColumn<QString>("string"); QTest::addColumn<QString>("result"); QTest::newRow("89-456") << QL1("89-456") << QL1("89000456"); QTest::newRow("2001-1114") << QL1("2001-1114") << QL1("2001001114"); QTest::newRow("gm 71-2450 ") << QL1("gm 71-2450 ") << QL1("gm71002450"); QTest::newRow("n78-890351 ") << QL1("n78-890351 ") << QL1("n78890351"); QTest::newRow("n78-89035") << QL1("n78-89035") << QL1("n78089035"); QTest::newRow("n 78890351") << QL1("n 78890351") << QL1("n78890351"); QTest::newRow("85-2") << QL1("85-2") << QL1("85000002"); QTest::newRow("75-425165//r75") << QL1("75-425165//r75") << QL1("75425165"); QTest::newRow(" 79139101 /AC/r932") << QL1(" 79139101 /AC/r932") << QL1("79139101"); }
void IsbnTest::testFixup_data() { QTest::addColumn<QString>("string"); QTest::addColumn<QString>("expectedIsbn"); // garbage QTest::newRow("My name is robby") << QL1("My name is robby") << QString(); QTest::newRow("http://www.abclinuxu.cz/clanky/show/63080") << QL1("http://www.abclinuxu.cz/clanky/show/63080") << QL1("6-3080"); // initial checks QTest::newRow("0-446-60098-9") << QL1("0-446-60098-9") << QL1("0-446-60098-9"); // check sum value QTest::newRow("0-446-60098") << QL1("0-446-60098") << QL1("0-446-60098-9"); // check EAN-13 QTest::newRow("9780940016750") << QL1("9780940016750") << QL1("978-0-940016-75-0"); QTest::newRow("978-0940016750") << QL1("978-0940016750") << QL1("978-0-940016-75-0"); QTest::newRow("978-0-940016-75-0") << QL1("978-0-940016-75-0") << QL1("978-0-940016-75-0"); QTest::newRow("978286274486") << QL1("978286274486") << QL1("978-2-86274-486-5"); QTest::newRow("9788186119130") << QL1("9788186119130") << QL1("978-81-86-11913-6"); QTest::newRow("9788186119137") << QL1("9788186119137") << QL1("978-81-86-11913-6"); QTest::newRow("97881-8611-9-13-0") << QL1("97881-8611-9-13-0") << QL1("978-81-86-11913-6"); QTest::newRow("97881-8611-9-13-7") << QL1("97881-8611-9-13-7") << QL1("978-81-86-11913-6"); // don't add checksum for EAN that start with 978 or 979 and are less than 13 in length QTest::newRow("978059600") << QL1("978059600") << QL1("978-059600"); QTest::newRow("978-0596000") << QL1("978-0596000") << QL1("978-059600-0"); // normal english-language hyphenation QTest::newRow("0") << QL1("0") << QL1("0"); QTest::newRow("05") << QL1("05") << QL1("0-5"); QTest::newRow("059") << QL1("059") << QL1("0-59"); QTest::newRow("0596") << QL1("0596") << QL1("0-596"); QTest::newRow("05960") << QL1("05960") << QL1("0-596-0"); QTest::newRow("059600") << QL1("059600") << QL1("0-596-00"); QTest::newRow("0596000") << QL1("0596000") << QL1("0-596-000"); QTest::newRow("05960005") << QL1("05960005") << QL1("0-596-0005"); // checksum gets added QTest::newRow("059600053") << QL1("059600053") << QL1("0-596-00053-7"); QTest::newRow("0-596-00053") << QL1("0-596-00053") << QL1("0-596-00053-7"); QTest::newRow("044660098") << QL1("044660098") << QL1("0-446-60098-9"); QTest::newRow("0446600989") << QL1("0446600989") << QL1("0-446-60098-9"); // check french hyphenation QTest::newRow("2862744867") << QL1("2862744867") << QL1("2-86274-486-7"); // check german hyphenation QTest::newRow("3423071516") << QL1("3423071516") << QL1("3-423-07151-6"); // check polish hyphenation QTest::newRow("978-83-7436-170-5") << QL1("9788374361705") << QL1("978-83-7436-170-5"); // check keeping middle hyphens QTest::newRow("6-18611913-0") << QL1("6-18611913-0") << QL1("6-18611913-0"); QTest::newRow("6-186119-13-0") << QL1("6-186119-13-0") << QL1("6-186119-13-0"); QTest::newRow("6-18611-9-13-0") << QL1("6-18611-9-13-0") << QL1("6-18611-913-0"); }
void IsbnTest::testState_data() { QTest::addColumn<QValidator::State>("expectedState"); QTest::addColumn<QString>("value"); QTest::addColumn<bool>("changedValue"); QTest::newRow("0") << QValidator::Intermediate << QL1("0") << false; QTest::newRow("0-") << QValidator::Intermediate << QL1("0-") << false; QTest::newRow("0-3") << QValidator::Intermediate << QL1("0-3") << false; QTest::newRow("0-32") << QValidator::Intermediate << QL1("0-32") << false; QTest::newRow("0-321") << QValidator::Intermediate << QL1("0-321") << false; QTest::newRow("0-321-") << QValidator::Intermediate << QL1("0-321-") << false; QTest::newRow("0-321-1") << QValidator::Intermediate << QL1("0-321-1") << false; QTest::newRow("0-321-11") << QValidator::Intermediate << QL1("0-321-11") << false; QTest::newRow("0-321-113") << QValidator::Intermediate << QL1("0-321-113") << false; QTest::newRow("0-321-1135") << QValidator::Intermediate << QL1("0-321-1135") << false; // checksum is added QTest::newRow("0-321-11358") << QValidator::Acceptable << QL1("0-321-11358") << true; QTest::newRow("0-321-11358-") << QValidator::Acceptable << QL1("0-321-11358-") << true; QTest::newRow("0-321-11358-6") << QValidator::Acceptable << QL1("0-321-11358-6") << false; QTest::newRow("0") << QValidator::Intermediate << QL1("0") << true; QTest::newRow("03") << QValidator::Intermediate << QL1("03") << true; QTest::newRow("032") << QValidator::Intermediate << QL1("032") << true; QTest::newRow("0321") << QValidator::Intermediate << QL1("0321") << true; QTest::newRow("03211") << QValidator::Intermediate << QL1("03211") << true; QTest::newRow("032111") << QValidator::Intermediate << QL1("032111") << true; QTest::newRow("0321113") << QValidator::Intermediate << QL1("0321113") << true; QTest::newRow("03211135") << QValidator::Intermediate << QL1("03211135") << true; // checksum is added QTest::newRow("032111358") << QValidator::Acceptable << QL1("032111358") << true; QTest::newRow("0321113586") << QValidator::Acceptable << QL1("0321113586") << true; // considered 10-digit ISBNs QTest::newRow("9") << QValidator::Intermediate << QL1("9") << false; QTest::newRow("97") << QValidator::Intermediate << QL1("97") << false; QTest::newRow("978") << QValidator::Intermediate << QL1("978") << false; QTest::newRow("978-") << QValidator::Intermediate << QL1("978-") << false; QTest::newRow("978-0") << QValidator::Intermediate << QL1("978-0") << false; QTest::newRow("978-0-") << QValidator::Intermediate << QL1("978-0-") << false; QTest::newRow("978-0-4") << QValidator::Intermediate << QL1("978-0-4") << false; QTest::newRow("978-0-47") << QValidator::Intermediate << QL1("978-0-47") << false; QTest::newRow("978-0-470") << QValidator::Intermediate << QL1("978-0-470") << false; QTest::newRow("978-0-470-") << QValidator::Intermediate << QL1("978-0-470-") << false; QTest::newRow("978-0-4701") << QValidator::Intermediate << QL1("978-0-4701") << false; QTest::newRow("978-0-470-1") << QValidator::Intermediate << QL1("978-0-470-1") << true; QTest::newRow("978-0-47014") << QValidator::Intermediate << QL1("978-0-47014") << false; QTest::newRow("978-0-470-14") << QValidator::Intermediate << QL1("978-0-470-14") << true; QTest::newRow("978-0-470-147") << QValidator::Intermediate << QL1("978-0-470-147") << true; QTest::newRow("978-0-470147") << QValidator::Intermediate << QL1("978-0-470147") << true; QTest::newRow("978-0-47014-7") << QValidator::Intermediate << QL1("978-0-47014-7") << false; // now considered 13-digit ISBN QTest::newRow("978-0-470-1476") << QValidator::Intermediate << QL1("978-0-470-1476") << false; // checksum is added QTest::newRow("978-0-470-14762") << QValidator::Acceptable << QL1("978-0-470-14762") << true; QTest::newRow("978-0-470-14762-") << QValidator::Acceptable << QL1("978-0-470-14762-") << true; QTest::newRow("978-0-470-14762-7") << QValidator::Acceptable << QL1("978-0-470-14762-7") << false; }
void IsbnTest::testComparison_data() { QTest::addColumn<QString>("value1"); QTest::addColumn<QString>("value2"); QTest::addColumn<bool>("equal"); QTest::newRow("0446600989, 0-446-60098-9") << QL1("0446600989") << QL1("0-446-60098-9") << true; QTest::newRow("0940016753, 9780940016750") << QL1("0940016753") << QL1("9780940016750") << true; QTest::newRow("9780940016750, 0940016753") << QL1("9780940016750") << QL1("0940016753") << true; QTest::newRow("9780940016750, 978-0-940016-75-0") << QL1("9780940016750") << QL1("978-0-940016-75-0") << true; QTest::newRow("3-351-005296, 3351005296") << QL1("3-351-005296") << QL1("3351005296") << true; QTest::newRow("3-351-00529-6, 3351005296") << QL1("3-351-00529-6") << QL1("3351005296") << true; }