本文整理汇总了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;
}
示例2: main
int main(void)
{
Test test;
test.print();
return 0;
}
示例3: main
int main()
{
Test b;
Test c;
b.function(c);
return 0;
}
示例4: main
int main()
{
Test a;
a.foo();
return 0;
}
示例5: main
int main()
{
Test unused; // { dg-warning "unused variable" }
Test used; // { dg-bogus "unused variable" }
TestNormal normal; // { dg-bogus "unused variable" }
used.use();
}
示例6: main
int main()
{
Test test;
test.setNum(2);
cout << test.getNum()<<endl;
return 0;
}
示例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();
}
示例8: main
int main(){
Command c1 = Command();
Test aTest = Test();
printf("%p\n",&c1.command);
aTest.a();
c1.a();
}
示例9: main
int main(){
int (*fefe)(int a,int b)=bba;
Test t;
t.go();
testA(bba);
return -1;
};
示例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;
}
示例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;
}
}
示例12: main
int main() {
Test test;
test.run();
return 0;
}
示例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);
}
}
}
}
}
示例14: main
int main()
{
Test obj;
obj.destroy();
obj.print();
return 0;
}
示例15: PrintGreater
void PrintGreater(Trial *obj)
{
Test *work = dynamic_cast<Test*>(obj);
if (work->GetScore() > user)
{
work->Print();
}
}