< Summary

Class:Lightable
Assembly:Test
File(s):E:/Unity/Unity Project/EscapeTheRoomVR/Assets/Test 1/Lightable.cs
Covered lines:12
Uncovered lines:2
Coverable lines:14
Total lines:28
Line coverage:85.7% (12 of 14)
Covered branches:0
Total branches:0
Covered methods:4
Total methods:4
Method coverage:100% (4 of 4)

Coverage History

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Start()0%000100%
ToggleLight()0%00072.73%

File(s)

E:/Unity/Unity Project/EscapeTheRoomVR/Assets/Test 1/Lightable.cs

#LineLine coverage
 1using System.Collections;
 2using System.Collections.Generic;
 3using UnityEngine;
 4
 5public class Lightable : MonoBehaviour {
 25636    public bool on { get; private set; }
 7
 8    // Lightable game objects are off by default at start
 29  public void Start() {
 210        on = false;
 211    gameObject.GetComponentInChildren<Light>().enabled = false;
 212  }
 13
 114  public void ToggleLight() {
 15        // Toggle light switch
 116        on = !on;
 117    gameObject.GetComponentInChildren<Light> ().enabled =
 18      !gameObject.GetComponentInChildren<Light> ().enabled;
 19    // Change message based on light switch position
 220        if (on) {
 121      gameObject.GetComponent<Inspectable>().inspectMessage = "That's much better...";
 122    } else {
 023      gameObject.GetComponent<Inspectable>().inspectMessage = "Hello darkness, my old friend...";
 024    }
 25
 26
 127  }
 28}