545 {
546
547 bool wasEnabled = EnProfiler.RequestImmediateData();
548
549
550
551
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
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
566 int previousCountRG = EnProfiler.GetCountOfFunc(
"TestFuncCountDataHelper",
Type(),
true);
568 int postCountRG = EnProfiler.GetCountOfFunc(
"TestFuncCountDataHelper",
Type(),
true);
569
570 int callCountRG = postCountRG - previousCountRG;
571
572
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
580 int callCountNon = EnProfiler.GetCountOfFunc(
"Non Existing Method",
Type(),
true);
581
582
583 int previousCountS = EnProfiler.GetCountOfFunc(
"TestFuncCountDataHelperStatic",
Type(),
true);
585 int postCountS = EnProfiler.GetCountOfFunc(
"TestFuncCountDataHelperStatic",
Type(),
true);
586
587 int callCountS = postCountS - previousCountS;
588
589
590 int previousCountG = EnProfiler.GetCountOfFuncG("GetDayZGame", true);
592 int postCountG = EnProfiler.GetCountOfFuncG("GetDayZGame", true);
593
594 int callCountG = postCountG - previousCountG;
595
596
597
599 int callCountGP = EnProfiler.GetCountOfFuncG("ErrorEx", true);
600
601
602
603 int callCountSP = EnProfiler.GetCountOfFunc("GetCountOfFunc", StaticGetType(EnProfiler), true);
604
605
606
608 int callCountP = EnProfiler.GetCountOfFunc(
"GetHostName",
g_Game.Type(),
true);
609
610
611
613 int callCountPN = EnProfiler.GetCountOfFunc(
"IsServer",
g_Game.Type(),
true);
614
615
616
617 ErrorModuleHandler.GetInstance();
618 int callCountSPN = EnProfiler.GetCountOfFunc("GetInstance", StaticGetType(ErrorModuleHandler), true);
619
620
621 if (!wasEnabled)
622 {
623 EnProfiler.Enable(false, true);
624 }
625
626
627
628
629 if (!
Assert(callCountCF == 1))
630 {
632 }
633
634
635 if (!
Assert(callCountCFP == 1))
636 {
638 }
639
640
641 if (!
Assert(callCountRG == 1))
642 {
644 }
645
646
647 if (!
Assert(callCountC == 1))
648 {
650 }
651
652
653 if (!
Assert(callCountNon == -1))
654 {
656 }
657
658
659 if (!
Assert(callCountS == 1))
660 {
662 }
663
664
665 if (!
Assert(callCountG == 1))
666 {
668 }
669
670
671 if (!
Assert(callCountGP == 0))
672 {
674 }
675
676
677 if (!
Assert(callCountSP == 0))
678 {
680 }
681
682
683 if (!
Assert(callCountP == 0))
684 {
686 }
687
688
689 if (!
Assert(callCountPN == 0))
690 {
692 }
693
694
695 if (!
Assert(callCountSPN == 0))
696 {
698 }
699
701 }
TFResult NTFR(TFR result)
bool Assert(bool condition)
void TestFuncCountDataHelper()
static void TestFuncCountDataHelperStatic()