< Summary - Backend C Tests - Coverage Report (WSL)

Information
Class: test_stack_c
Assembly: src.backend.tests.unit
File(s): ./src/backend/tests/unit/test_stack.c
Line coverage
100%
Covered lines: 32
Uncovered lines: 0
Coverable lines: 32
Total lines: 43
Line coverage: 100%
Branch coverage
50%
Covered branches: 11
Total branches: 22
Branch coverage: 50%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Coverage history

Coverage history 0 25 50 75 100 2/18/2026 - 10:50:55 PM Line coverage: 100% (32/32) Branch coverage: 50% (11/22) Total lines: 43 2/18/2026 - 10:50:55 PM Line coverage: 100% (32/32) Branch coverage: 50% (11/22) Total lines: 43

File(s)

./src/backend/tests/unit/test_stack.c

#LineLine coverage
 1#include <stdio.h>
 2#include <assert.h>
 3#include "../../core/data_structures/stack.h"
 4
 15void test_stack_init() {
 6  Stack s;
 17  initStack(&s);
 18  assert(s.top == 0);
 19  assert(s.count == 0);
 110  printf("Stack Init Test Passed\n");
 111}
 12
 113void test_stack_push_pop() {
 14  Stack s;
 115  initStack(&s);
 116  Operation op1 = {1, 101, OP_FAULT_ENTRY, 0.0, "2025-01-01"};
 117  Operation op2 = {2, 102, OP_PART_REPLACEMENT, 1.0, "2025-01-02"};
 118  push(&s, op1);
 119  assert(getUndoCount(&s) == 1);
 120  push(&s, op2);
 121  assert(getUndoCount(&s) == 2);
 22  Operation out;
 123  assert(pop(&s, &out) == true);
 124  assert(out.operation_id == 2);
 125  assert(getUndoCount(&s) == 1);
 126  assert(pop(&s, &out) == true);
 127  assert(out.operation_id == 1);
 128  assert(getUndoCount(&s) == 0);
 129  assert(pop(&s, &out) == false);
 130  printf("Stack Push/Pop Test Passed\n");
 131}
 32
 133void run_stack_tests() {
 134  printf("Running Stack Tests...\n");
 135  test_stack_init();
 136  test_stack_push_pop();
 137  printf("All Stack Tests Passed!\n");
 138}
 39
 140int main() {
 141  run_stack_tests();
 142  return 0;
 43}

Methods/Properties