Example #1
0
/**@brief ten watek tworzy nowy test i co sekunde zapisuje do niego data_test
 *@param param parametrem jest obiekt klienta
*/
DWORD WINAPI starting_thread(LPVOID param)
{
    Client *client = (Client*)param; //rzutowanie na wskaźnik typu "Client"
    int sum = 0;
    void **parameters = new void*[2];
    parameters[0] = client;
    parameters[1] = ∑
    Database baza;
             //laczymy sie z baza, tudziez tworzymy nowa jesli nie istnieje
    Test *newTest = baza.StworzTest();  //tworzymy nowy test w bazie
    actualTest = newTest ;
    int second = 1;                   //tworzy nastepny watek, ktory bedzie odbieral 4KB przeslanych danych
                                    //watek zakonczy sie kiedy wykonana zostanie metoda stop_test
    CreateThread(NULL, 0, recieving_thread, (LPVOID)parameters, 0, NULL);
    while(client->is_started())     //petla dziala dopoki nie zostanie wykonana metoda "stop_test"
    {                               //usypia watek na sekunde, aby po uplywie tego czasu
        Sleep(1000);                //dodac kolejny data_test do utworzonego testu
        baza.DodajKolejnyDataTest(newTest->GetID(), second, sum);   //dodajemy co sekunde nowy data_test do nowoutworzonego testu
        sum = 0;                    //zerujemy licznik przeslanych danych
        ++second;
        actualTest->AddDataTest(baza.ZwrocNowyDataTest());                //inkrementujemy zmienna, ktora przechowuje aktualna sekunde dzialania watku
    }
    baza.ZakonczTest(newTest->GetID());// metoda ZakonczTest ustawia nam date i czas konca testu podanego jako parametr
    closesocket(client->get_socket());//przerywa polaczenie z serwerem; dzieki temu serwer przestaje przesylac dane
    delete []parameters;
    return 0;
}
Example #2
0
int main(void)
{
	Test test;
	test.print();

	return 0;
}
Example #3
0
int main()
{
    Test b;
    Test c;
    b.function(c);
    return 0;
}
Example #4
0
int main()
{
  Test a;
  a.foo();

  return 0;
}
Example #5
0
int main()
{
    Test unused;         // { dg-warning "unused variable" }
    Test used;           // { dg-bogus "unused variable" }
    TestNormal normal;   // { dg-bogus "unused variable" }
    used.use();
}
Example #6
0
int main()
{
	Test test;
	test.setNum(2);
	cout << test.getNum()<<endl;
	return 0;
}
Example #7
0
File: main.cpp Project: CCJY/coliru
int main()
{   
    Test test;
    
    std::atomic<bool> quit{};
    
    std::thread t1([&](){
        while (!quit) {
            test.increment_first();
        }
    });
    
    std::thread t2([&](){
        while (!quit) {
            test.increment_second();
        }
    });
    
    std::thread t3([&](){
        while (!quit) {
            auto snapshot = test.get_snapshot();
            std::cout << "Snapshot: " << std::get<0>(snapshot) << ", " << std::get<1>(snapshot) << ", sum: " << std::get<2>(snapshot) << std::endl;
            assert(std::get<0> + std::get<1> == std::get<2>);
        }
    });
    
    std::this_thread::sleep_for(std::chrono::milliseconds(1));
    quit = true;
    t1.join();
    t2.join();
    t3.join();
}
Example #8
0
int main(){
    Command c1 = Command();
    Test aTest = Test();
    printf("%p\n",&c1.command);
    aTest.a();
    c1.a();
}
Example #9
0
int main(){
	int (*fefe)(int a,int b)=bba;
	Test t;
	t.go();
	testA(bba);
	return -1;
};
Example #10
0
Context DefTemp::getContext(HttpRequest* request)
{
	Context cnt;
	string dat = "1.js";
	GenericObject dato;
	dato << dat;
	cnt["dat"] = dato;

	Test* t = new Test;
	t->setId(1);
	t->setName("name");
	GenericObject to;
	to << t;
	delete t;
	cnt["test"] = to;

	vector<string>* vect = new vector<string>;
	vect->push_back("vec1");
	vect->push_back("vec2");
	GenericObject vecto;
	vecto << vect;
	delete vect;
	cnt["vect"] = vecto;

	int* num = new int(5);
	GenericObject numo;
	numo << num;
	delete num;
	cnt["number"] = numo;
	return cnt;
}
Example #11
0
int main() {

    bool nothingFailed = true;
    Test model;

    CPPCMSSKEL_TEST_RESULT_WORK(
        "Try to create the tables ... " ,
        model.import_sql_file(
          SQL_PATH TEST_PATH BASIC_SQL
        ),
        nothingFailed
    );


    CPPCMSSKEL_TEST_RESULT_WORK(
        "Try to check if we know that the admin is admin ... " ,
        model.test_work(),
        nothingFailed
    );

    CPPCMSSKEL_TEST_RESULT_NOT_WORK(
        "Try to check if we know an normal user is not admin ... " ,
        model.test_not_work(),
        nothingFailed
    );


    if (nothingFailed) {
        return 0;
    } else {
        return 1;
    }
}
Example #12
0
int main() {
    
    Test test;
    test.run();

    return 0;
}
Example #13
0
void Module::RunModuleLevelTests(bool runCleanup)
{            
    // We want to run module level tests once only if
    // 1. we are in isolation mode and we are child process
    // 2. we are in non-isolation mode in which case we will run other tests in the parent process and so we should run module setup here
    if(!(Run::GetInstance().IsChild()))
        return;

    // Find and run moduleSetups if any exist    
    for (size_t i = 0; i < m_tests.size(); i++)
    {
        Test *currentTest = m_tests[i];
        if(currentTest->IsNewInterfaceTest())
        {
            struct RegistrationInfo *r = (struct RegistrationInfo *) (currentTest->m_registration);
            if(ModuleSetupFixture == r->fixtureType)
            {
                if(!runCleanup)
                {
                    currentTest->m_cleanupMode = TestSystem::Test::DeferredCleanup;
                    // running ModuleSetups in isolation doesnt make any sense since 
                    // they are run for the module once anyways and any other test which 
                    // will run in isolation will get its ModuleSetup run in the child process
                    currentTest->m_isolation = false;
                    Run::GetInstance().ExecuteTest(currentTest, NULL, r->fixtureType);
                }
                else
                {
                    Run::GetInstance().ExecuteDeferredCleanup(currentTest);
                }
            }
        }                
    }
}
Example #14
0
int main()
{
  Test obj;
  obj.destroy();
  obj.print();
  return 0;
}
Example #15
0
void PrintGreater(Trial *obj)
{
	Test *work = dynamic_cast<Test*>(obj);
	if (work->GetScore() > user)
	{
		work->Print();
	}
}
Example #16
0
void TestRegistry::run (TestResult& result) 
{
	result.testsStarted ();

	for (Test *test = tests; test != 0; test = test->getNext ())
		test->run (result);
	result.testsEnded ();
}
Example #17
0
void testTimerEvent()
{
	LOGT("<testTimerEvent>");
	Test t;
	t.setInterval(500);
	t.start();
	Thread::sleep(3300);
}
Example #18
0
int main(int Argc, char* Argv[]) {

Test start;

start.run(Argc, Argv);

return 0;
}
Example #19
0
int main(int Argc, char ** Argv){

Test test;
test.Przygotuj();
test.Wykonaj();

return 0;   
}
Example #20
0
void main()
{
	Test test;
	//test.Test(1);
	cout << " hello world " << endl;
	cout << " yes it is! " << endl;
	test.printData();
}
Example #21
0
int main() {
  Test<unsigned> t;
  t.set(Test<unsigned>::A, 5.5);
  t.set(Test<unsigned>::T, 5.6);
  t.set(Test<unsigned>::G, 5.7);
  t.set(Test<unsigned>::C, 5.8);
  return 0;
}
Example #22
0
File: main.cpp Project: CCJY/coliru
int main(int argc, char* argv[])
{
    
    Test a;
    a.print();
    
	return 0;
}
Example #23
0
void PrintPassed(Trial *obj)
{
	Test *work = dynamic_cast<Test*>(obj);
	if (work->GetScore() > work->GetMinScore())
	{
		work->Print();
	}
}
Example #24
0
bool Testit<2006>::Main() 
 { 
  Test test;
  
  test.run();
  
  return true;
 }
Example #25
0
int main(int argc, char *argv[]) {
	srand(time(NULL));

	Test tests;
	tests.performTests();

	return 0;
}
Example #26
0
int main(int argc, char **argv)
{
    QApplication::setApplicationName("ktabwidgettest");
    QApplication app(argc, argv);
    Test *t = new Test();
    t->show();
    app.exec();
}
Example #27
0
int main()
{
    Test t = Test();
    assert(t.check());
    assert(! t.check());
    //std::cout << "ok" << std::endl;
    return 0;
}
inline void TextResultPrinter::onSuite(const Test& test, const std::string& newline)
{
    if (test.getName() == "All Tests" || test.countChildTests() == 0)
        return;

    out << GREEN << newline << "[----------] "
        << WHITE << test.countTestCases() << " tests from " << test.getName() << std::endl;
}
Example #29
0
File: This.cpp Project: miank/Cpp
int main()
{
	Test obj;
	int x = 20;
	obj.SetX(x);
	obj.Print();
    return 0;
}
Example #30
0
int main(int argc, char** argv )
{
    KCmdLineArgs::init(argc, argv, "ktabwidgettest", 0, ki18n("KTabWidgetTest"), "1.0", ki18n("ktabwidget test app"));
    //KApplication::disableAutoDcopRegistration();
    KApplication app;
    Test *t = new Test();
    t->show();
    app.exec();
}