DayZ 1.27
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 GetGame().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 GetGame().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 GetGame().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
608 int callCountP = EnProfiler.GetCountOfFunc("GetHostName", GetGame().Type(), true);
609
610 // - proto native
611 // Not tracked, so don't need to compare before and after, should always be 0
612 GetGame().IsServer();
613 int callCountPN = EnProfiler.GetCountOfFunc("IsServer", GetGame().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 GetDayZGame()
Определения DayZGame.c:3870
string Type
Определения JsonDataContaminatedArea.c:11
TFResult NTFR(TFR result)
Определения TestFramework.c:273
bool Assert(bool condition)
Определения TestFramework.c:262
TFR
Определения TestFramework.c:2
proto owned string GetHostName()
Gets the server name. (from client)
proto native bool IsServer()
ScriptModule GameScript
Определения Game.c:12
void TestFuncCountDataHelper()
Определения EnProfilerTests.c:748
static void TestFuncCountDataHelperStatic()
Определения EnProfilerTests.c:755
proto native CGame GetGame()
ErrorExSeverity
Определения EnDebug.c:62
enum ShapeType ErrorEx
proto volatile int CallFunctionParams(Class inst, string function, out void returnVal, Class parms)
proto volatile int Call(Class inst, string function, void parm)
proto volatile int CallFunction(Class inst, string function, out void returnVal, void parm)

Перекрестные ссылки Assert(), ScriptModule::Call(), ScriptModule::CallFunction(), ScriptModule::CallFunctionParams(), EnProfiler::Enable(), ErrorEx, CGame::GameScript, EnProfiler::GetCountOfFunc(), EnProfiler::GetCountOfFuncG(), GetDayZGame(), GetGame(), CGame::GetHostName(), ErrorModuleHandler::GetInstance(), CGame::IsServer(), NTFR(), EnProfiler::RequestImmediateData(), TestFuncCountDataHelper(), TestFuncCountDataHelperStatic(), TFResult() и Type.