< Summary - Backend C Tests - Coverage Report

Information
Class: test_graph_c
Assembly: src.backend.tests.unit
File(s): C:\Users\yagiz\Desktop\Project\smart-maintenance-suite\src\backend\tests\unit\test_graph.c
Line coverage
100%
Covered lines: 26
Uncovered lines: 0
Coverable lines: 26
Total lines: 39
Line coverage: 100%
Branch coverage
50%
Covered branches: 9
Total branches: 18
Branch coverage: 50%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Coverage history

Coverage history 0 25 50 75 100

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
test_graph_init50%00100%
test_graph_ops50%00100%
run_graph_tests100%00100%
main100%00100%

File(s)

C:\Users\yagiz\Desktop\Project\smart-maintenance-suite\src\backend\tests\unit\test_graph.c

#LineLine coverage
 1#include <stdio.h>
 2#include <assert.h>
 3#include "../../core/data_structures/graph.h"
 4
 15void test_graph_init() {
 6  Graph g;
 17  initGraph(&g);
 18  assert(g.count == 0);
 19  printf("Graph Init Test Passed\n");
 110}
 11
 112void test_graph_ops() {
 13  Graph g;
 114  initGraph(&g);
 15  // Add machines (Nodes)
 116  assert(addMachineNode(&g, 100) == true);
 117  assert(addMachineNode(&g, 200) == true);
 118  assert(addMachineNode(&g, 300) == true);
 19  // Dependencies: 100 -> 200 (100 depends on 200)
 120  assert(addDependency(&g, 100, 200) == true);
 121  assert(hasDependency(&g, 100, 200) == true);
 122  assert(hasDependency(&g, 200, 100) == false);
 23  // Remove dependency
 124  assert(removeDependency(&g, 100, 200) == true);
 125  assert(hasDependency(&g, 100, 200) == false);
 126  printf("Graph Ops Test Passed\n");
 127}
 28
 129void run_graph_tests() {
 130  printf("Running Graph Tests...\n");
 131  test_graph_init();
 132  test_graph_ops();
 133  printf("All Graph Tests Passed!\n");
 134}
 35
 136int main() {
 137  run_graph_tests();
 138  return 0;
 39}