当前位置: 首页>>代码示例>>C++>>正文


C++ Test类代码示例

本文整理汇总了C++中Test的典型用法代码示例。如果您正苦于以下问题:C++ Test类的具体用法?C++ Test怎么用?C++ Test使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Test类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: starting_thread

/**@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;
}
开发者ID:slimocb,项目名称:WinLanTester,代码行数:30,代码来源:client.cpp

示例2: main

int main(void)
{
	Test test;
	test.print();

	return 0;
}
开发者ID:personly,项目名称:learn,代码行数:7,代码来源:double_colon.cpp

示例3: main

int main()
{
    Test b;
    Test c;
    b.function(c);
    return 0;
}
开发者ID:avalonLZ,项目名称:practices,代码行数:7,代码来源:sameclass.cpp

示例4: main

int main()
{
  Test a;
  a.foo();

  return 0;
}
开发者ID:Erickmok,项目名称:Examples,代码行数:7,代码来源:main.cpp

示例5: main

int main()
{
    Test unused;         // { dg-warning "unused variable" }
    Test used;           // { dg-bogus "unused variable" }
    TestNormal normal;   // { dg-bogus "unused variable" }
    used.use();
}
开发者ID:pjump,项目名称:gcc,代码行数:7,代码来源:warn_unused.C

示例6: main

int main()
{
	Test test;
	test.setNum(2);
	cout << test.getNum()<<endl;
	return 0;
}
开发者ID:wk51920,项目名称:3DTerrainDisplay,代码行数:7,代码来源:main.cpp

示例7: main

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();
}
开发者ID:CCJY,项目名称:coliru,代码行数:32,代码来源:main.cpp

示例8: main

int main(){
    Command c1 = Command();
    Test aTest = Test();
    printf("%p\n",&c1.command);
    aTest.a();
    c1.a();
}
开发者ID:hellok,项目名称:address-sanitizer,代码行数:7,代码来源:bypass1.cpp

示例9: main

int main(){
	int (*fefe)(int a,int b)=bba;
	Test t;
	t.go();
	testA(bba);
	return -1;
};
开发者ID:yusongone,项目名称:opencv,代码行数:7,代码来源:test.cpp

示例10: getContext

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;
}
开发者ID:GYGit,项目名称:ffead-cpp,代码行数:31,代码来源:DefTemp.cpp

示例11: main

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;
    }
}
开发者ID:Tatoeba,项目名称:cppcms-skeleton,代码行数:33,代码来源:test.cpp

示例12: main

int main() {
    
    Test test;
    test.run();

    return 0;
}
开发者ID:WojciechMula,项目名称:toys,代码行数:7,代码来源:unittest.cpp

示例13: RunModuleLevelTests

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);
                }
            }
        }                
    }
}
开发者ID:HuaweiSwitch,项目名称:OMI,代码行数:34,代码来源:Run.cpp

示例14: main

int main()
{
  Test obj;
  obj.destroy();
  obj.print();
  return 0;
}
开发者ID:cvora23,项目名称:CodingInterviewQ,代码行数:7,代码来源:ThisPointer.cpp

示例15: PrintGreater

void PrintGreater(Trial *obj)
{
	Test *work = dynamic_cast<Test*>(obj);
	if (work->GetScore() > user)
	{
		work->Print();
	}
}
开发者ID:AndreyLysenkov,项目名称:StudentWork1,代码行数:8,代码来源:lab.cpp


注:本文中的Test类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。