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

◆ TestFuncCountData()

TFResult EnProfilerTests::TestFuncCountData ( )
inlineprivate

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

545 {
546 // We should restore this when done
547 bool wasEnabled = EnProfiler.RequestImmediateData();
548
549 // Time to count
550
551 // - CallFunction
552 int previousCountCF = EnProfiler.GetCountOfFunc("TestFuncCountDataHelper", Type(), true);
553 g_Game.GameScript.CallFunction(this, "TestFuncCountDataHelper", null, 0);
554 int postCountCF = EnProfiler.GetCountOfFunc("TestFuncCountDataHelper", Type(), true);
555
556 int callCountCF = postCountCF - previousCountCF;
557
558 // - CallFunctionParams
559 int previousCountCFP = EnProfiler.GetCountOfFunc("TestFuncCountDataHelper", Type(), true);
560 g_Game.GameScript.CallFunctionParams(this, "TestFuncCountDataHelper", null, null);
561 int postCountCFP = EnProfiler.GetCountOfFunc("TestFuncCountDataHelper", Type(), true);
562
563 int callCountCFP = postCountCFP - previousCountCFP;
564
565 // - Regular call
566 int previousCountRG = EnProfiler.GetCountOfFunc("TestFuncCountDataHelper", Type(), true);
568 int postCountRG = EnProfiler.GetCountOfFunc("TestFuncCountDataHelper", Type(), true);
569
570 int callCountRG = postCountRG - previousCountRG;
571
572 // - Call
573 int previousCountC = EnProfiler.GetCountOfFunc("TestFuncCountDataHelper", Type(), true);
574 g_Game.GameScript.Call(this, "TestFuncCountDataHelper", 0);
575 int postCountC = EnProfiler.GetCountOfFunc("TestFuncCountDataHelper", Type(), true);
576
577 int callCountC = postCountC - previousCountC;
578
579 // - Garbage
580 int callCountNon = EnProfiler.GetCountOfFunc("Non Existing Method", Type(), true);
581
582 // - Static
583 int previousCountS = EnProfiler.GetCountOfFunc("TestFuncCountDataHelperStatic", Type(), true);
585 int postCountS = EnProfiler.GetCountOfFunc("TestFuncCountDataHelperStatic", Type(), true);
586
587 int callCountS = postCountS - previousCountS;
588
589 // - Global
590 int previousCountG = EnProfiler.GetCountOfFuncG("GetDayZGame", true);
591 GetDayZGame();
592 int postCountG = EnProfiler.GetCountOfFuncG("GetDayZGame", true);
593
594 int callCountG = postCountG - previousCountG;
595
596 // - Global proto
597 // Not tracked, so don't need to compare before and after, should always be 0
598 ErrorEx("Testing global proto call", ErrorExSeverity.INFO);
599 int callCountGP = EnProfiler.GetCountOfFuncG("ErrorEx", true);
600
601 // - Static proto
602 // Not tracked, so don't need to compare before and after, should always be 0
603 int callCountSP = EnProfiler.GetCountOfFunc("GetCountOfFunc", StaticGetType(EnProfiler), true);
604
605 // - proto
606 // Not tracked, so don't need to compare before and after, should always be 0
607 g_Game.GetHostName();
608 int callCountP = EnProfiler.GetCountOfFunc("GetHostName", g_Game.Type(), true);
609
610 // - proto native
611 // Not tracked, so don't need to compare before and after, should always be 0
612 g_Game.IsServer();
613 int callCountPN = EnProfiler.GetCountOfFunc("IsServer", g_Game.Type(), true);
614
615 // - static proto native
616 // Not tracked, so don't need to compare before and after, should always be 0
617 ErrorModuleHandler.GetInstance();
618 int callCountSPN = EnProfiler.GetCountOfFunc("GetInstance", StaticGetType(ErrorModuleHandler), true);
619
620 // Restore
621 if (!wasEnabled)
622 {
623 EnProfiler.Enable(false, true);
624 }
625
626 // Do the checks
627
628 // - CallFunction
629 if (!Assert(callCountCF == 1))
630 {
631 return NTFR(TFR.FAIL);
632 }
633
634 // - CallFunctionParams
635 if (!Assert(callCountCFP == 1))
636 {
637 return NTFR(TFR.FAIL);
638 }
639
640 // - Regular call
641 if (!Assert(callCountRG == 1))
642 {
643 return NTFR(TFR.FAIL);
644 }
645
646 // - Call
647 if (!Assert(callCountC == 1))
648 {
649 return NTFR(TFR.FAIL);
650 }
651
652 // - Garbage
653 if (!Assert(callCountNon == -1))
654 {
655 return NTFR(TFR.FAIL);
656 }
657
658 // - Static
659 if (!Assert(callCountS == 1))
660 {
661 return NTFR(TFR.FAIL);
662 }
663
664 // - Global
665 if (!Assert(callCountG == 1))
666 {
667 return NTFR(TFR.FAIL);
668 }
669
670 // - Global proto
671 if (!Assert(callCountGP == 0))
672 {
673 return NTFR(TFR.FAIL);
674 }
675
676 // - Static proto
677 if (!Assert(callCountSP == 0))
678 {
679 return NTFR(TFR.FAIL);
680 }
681
682 // - proto
683 if (!Assert(callCountP == 0))
684 {
685 return NTFR(TFR.FAIL);
686 }
687
688 // - proto native
689 if (!Assert(callCountPN == 0))
690 {
691 return NTFR(TFR.FAIL);
692 }
693
694 // - static proto native
695 if (!Assert(callCountSPN == 0))
696 {
697 return NTFR(TFR.FAIL);
698 }
699
700 return NTFR(TFR.SUCCESS);
701 }
DayZGame g_Game
Определения DayZGame.c:3942
DayZGame GetDayZGame()
Определения DayZGame.c:3944
string Type
Определения JsonDataContaminatedArea.c:11
TFResult NTFR(TFR result)
Определения TestFramework.c:273
bool Assert(bool condition)
Определения TestFramework.c:262
TFR
Определения TestFramework.c:2
void TestFuncCountDataHelper()
Определения EnProfilerTests.c:748
static void TestFuncCountDataHelperStatic()
Определения EnProfilerTests.c:755
ErrorExSeverity
Определения EnDebug.c:62
enum ShapeType ErrorEx

Перекрестные ссылки Assert(), EnProfiler::Enable(), ErrorEx, g_Game, EnProfiler::GetCountOfFunc(), EnProfiler::GetCountOfFuncG(), GetDayZGame(), ErrorModuleHandler::GetInstance(), NTFR(), EnProfiler::RequestImmediateData(), TestFuncCountDataHelper(), TestFuncCountDataHelperStatic(), TFResult() и Type.