Dialogs::Dialogs(QWidget *parent) : QWidget(parent) { login=new Login(this); emTest=new EmotionTest(this); data = new Database(this); QLabel a("Thanks for participating", this); QHBoxLayout lay; lay.addWidget(&a); setLayout(&lay); if(data->makeConnection()) { // initializing the quote to be displayed in the typing test connect(this, SIGNAL(getQuote(int)), data, SLOT(getQuote(int))); connect(data, SIGNAL(setQuote(const QString&)), this, SLOT(setQuote(const QString&))); srand(time(NULL)); emit getQuote(rand() % 42); // checks the username and password combination connect(login, SIGNAL(info(const QString&, const QString&)), data, SLOT(login(const QString&, const QString&))); // if the username and password are valid then closes dialog connect(data, SIGNAL(acceptLogin(bool)), login, SLOT(acceptedInfo(bool))); // moves onto the EmotionTest connect(login, SIGNAL(accepted()), emTest, SLOT(exec())); // giving the emotionTest results to the database connect(emTest, SIGNAL(results(const QList<EmotionRank*>&)), data, SLOT(Emotions(const QList<EmotionRank*>&))); // if test results are put into the database then closes dialog connect(data, SIGNAL(acceptEmotions(bool)), emTest, SLOT(acceptedInfo(bool))); // moves onto the TypingTest connect(emTest, SIGNAL(accepted()), tyTest, SLOT(exec())); //getting previous TypingTest results connect(tyTest, SIGNAL(findPrevious()), data, SLOT(previousTyping())); connect(data, SIGNAL(previousTypingResults(const QList<KeyFeatures>&)), tyTest, SLOT(inputKeyFeatures(const QList<KeyFeatures>&))); //giving the TypingTest results to the database connect(tyTest, SIGNAL(results(const KeyFeatures&)), data, SLOT(Typing(const KeyFeatures&))); // if test results are put into the database then closes dialog connect(data, SIGNAL(acceptTyping(bool)), tyTest, SLOT(acceptedInfo(bool))); // closes everything connect(tyTest, SIGNAL(accepted()), data, SLOT(makeTest())); login->exec(); }
int main(int argc, char **argv) { if(TEST){ return makeTest(); } int allWrite = 0, maxT = 2, sizeIn, z=1; char* outName= NULL; char** fileIn = NULL; if(argc < 2){ fprintf(stderr,"Arguements incorrects\n"); return 1; } if(cmp(argv[z],"-d")){ allWrite = 1; z++; } if(cmp(argv[z],"--maxthreads")){ int tmp = atoi(argv[z+1]); if(tmp > 0){ maxT = tmp; } z += 2; } outName = (char*)malloc(sizeof(char)*strlen(argv[argc-1])); strcpy(outName, argv[argc-1]); // handle the files sizeIn = argc-z-1; fileIn = (char**)malloc(sizeof(char*)*sizeIn); int i=0; for(i=0; i < sizeIn; i++){ fileIn[i] = (char*) malloc(sizeof(char)*strlen(argv[z+i])); strcpy(fileIn[i], argv[z+i]); } run(maxT, outName, fileIn, sizeIn, allWrite); /* //for the ols tests char* in = "in.txt"; run(2, "fractaleot.bmp", &in, 1, 1); */ return 0; }
void broke(){ m = 26; printf("Possible keys:\n"); printf("\t b = any element of Zm\n"); int * as = makeTest(m,1); printf("%d posibity of keys\n", euler_phi(m) * m); int i, j; for(i = 0; i<euler_phi(m); i++){ a=as[i]; for (j = 0; j < m; ++j) { b=j; printf("a=%d, b=%d\n",a, b ); if(decript("c")[0] == 'e' && decript("b")[0] == 't') printf("%s\n", decript(text)); } } }
void testObj::test<8>(void) { ensure_equals( LIKELY( makeTest(21, 32) ), false); }
ChineseTest::ChineseTest(Dictionary *dict, const int &choice_num, const int &rand): Test(dict, rand), choice_num(choice_num) { makeTest(); }