DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ TestClassCountData()

TFResult EnProfilerTests::TestClassCountData ( )
inlineprivate

См. определение в файле EnProfilerTests.c строка 429

430 {
431 const int allocAmount = 9;
432 const int releaseAmount = 6;
433 int remainingAmount = allocAmount - releaseAmount;
434
435 // We should restore this when done
436 bool wasEnabled = EnProfiler.RequestImmediateData();
437
438 // Time to test
439 int previousAlloc = EnProfiler.GetAllocationsOfClass(StaticGetType(EPTHelperClass), true);
440 int previousInstances = EnProfiler.GetInstancesOfClass(StaticGetType(EPTHelperClass), true);
441
442 array<ref EPTHelperClass> instanceArr = {};
443 for (int i = 0; i < allocAmount; ++i)
444 {
445 instanceArr.Insert(new EPTHelperClass());
446 }
447
448 for (int j = 0; j < releaseAmount; ++j)
449 {
450 delete instanceArr[j];
451 }
452
453 int postAlloc = EnProfiler.GetAllocationsOfClass(StaticGetType(EPTHelperClass), true);
454 int postInstances = EnProfiler.GetInstancesOfClass(StaticGetType(EPTHelperClass), true);
455
456 int alloced = postAlloc - previousAlloc;
457 int instances = postInstances - previousInstances;
458
459 Debug.TFLog(string.Format("Profiling result: alloc: %1 | instances: %2", alloced, instances), this, "TestClassCountData");
460
461 // Restore
462 if (!wasEnabled)
463 EnProfiler.Enable(false, true);
464
465 // Time to check
466 if (!Assert(alloced == allocAmount))
467 {
468 return NTFR(TFR.FAIL);
469 }
470
471 if (!Assert(instances == remainingAmount))
472 {
473 return NTFR(TFR.FAIL);
474 }
475
476 return NTFR(TFR.SUCCESS);
477 }
TFResult NTFR(TFR result)
Определения TestFramework.c:273
bool Assert(bool condition)
Определения TestFramework.c:262
TFR
Определения TestFramework.c:2
void Debug()
Определения UniversalTemperatureSource.c:349

Перекрестные ссылки Assert(), EnProfiler::Enable(), EnProfiler::GetAllocationsOfClass(), EnProfiler::GetInstancesOfClass(), NTFR(), EnProfiler::RequestImmediateData(), Debug::TFLog() и TFResult().