< Summary

Class:Government
Assembly:Test
File(s):D:/--UnityProject/VR/subjects1_for_analysis/UnityCityView-master/UnityCityView-master/Assets/Scripts/Government.cs
Covered lines:29
Uncovered lines:2
Coverable lines:31
Total lines:52
Line coverage:93.5% (29 of 31)
Covered branches:0
Total branches:0
Covered methods:7
Total methods:7
Method coverage:100% (7 of 7)

Coverage History

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Start()0%000100%
Update()0%000100%
showlabel()0%000100%
GetLabel()0%00084.21%
GetBuilding8Name()0%000100%
GetBuilding9Name()0%000100%
GetBuilding91Name()0%000100%

File(s)

D:/--UnityProject/VR/subjects1_for_analysis/UnityCityView-master/UnityCityView-master/Assets/Scripts/Government.cs

#LineLine coverage
 1using System.Collections;
 2using System.Collections.Generic;
 3using UnityEngine;
 4using TMPro;
 5
 6public class Government : MonoBehaviour
 7{
 8    // Start is called before the first frame update
 9  GameObject label;
 10
 11    void Start()
 312    {
 313        GameObject player = GameObject.Find("Player");
 314    label = player.transform.GetChild(1).gameObject;
 315    }
 16
 17    // Update is called once per frame
 18    void Update()
 747019    {
 20
 747021    }
 322  public void showlabel(){
 323    label.GetComponent<TextMeshPro>().text = GetLabel().Substring(0, 20);
 324  }
 25
 326  string GetLabel(){
 327    string ret = "Government:";
 428    if(gameObject.name == "Building8"){
 129      ret = ret + GetBuilding8Name();
 430    }else if(gameObject.name == "Building9"){
 131      ret = ret + GetBuilding9Name();
 332    }else if(gameObject.name == "Building91"){
 133      ret = ret + GetBuilding91Name();
 134    }else{
 035      ret = ret + "Unknown Department";
 036    }
 337    return ret;
 338  }
 39
 140  string GetBuilding8Name(){
 141    return "Town Hall";
 142  }
 43
 144  string GetBuilding9Name(){
 145    return "Police Department";
 146  }
 47
 148  string GetBuilding91Name(){
 149    return "Financial Department";
 150  }
 51
 52}