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

Information
Class: router_c
Assembly: src.backend.api
File(s): ./src/backend/api/router.c
Line coverage
100%
Covered lines: 24
Uncovered lines: 0
Coverable lines: 24
Total lines: 41
Line coverage: 100%
Branch coverage
100%
Covered branches: 14
Total branches: 14
Branch coverage: 100%
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% (24/24) Branch coverage: 100% (14/14) Total lines: 41 2/18/2026 - 10:50:55 PM Line coverage: 100% (24/24) Branch coverage: 100% (14/14) Total lines: 41

File(s)

./src/backend/api/router.c

#LineLine coverage
 1#include "router.h"
 2#include "handlers/machine_handler.h"
 3#include "handlers/inventory_handler.h"
 4#include "handlers/auth_handler.h"
 5#include "handlers/maintenance_handler.h"
 6#include "handlers/report_handler.h"
 7#include "handlers/fault_handler.h"
 8#include "../database/alert_service.h"
 9#include <string.h>
 10#include <stdio.h>
 11#include <stdlib.h>
 12
 13
 14
 2215void handle_route(HttpRequest *req, HttpResponse *res) {
 16  // Default 404
 2217  res->status_code = 404;
 2218  strcpy(res->content_type, "application/json");
 2219  strcpy(res->body, "{\"error\": \"Route not found\"}");
 20
 2221  if (strstr(req->path, "/api/machines")) {
 522    handle_machine_request(req, res);
 1723  } else if (strstr(req->path, "/api/inventory")) {
 424    handle_inventory_request(req, res);
 1325  } else if (strstr(req->path, "/api/login")) {
 126    handle_auth_request(req, res);
 1227  } else if (strstr(req->path, "/api/maintenance")) {
 328    handle_maintenance_request(req, res);
 929  } else if (strstr(req->path, "/api/reports")) {
 230    handle_report_request(req, res);
 731  } else if (strstr(req->path, "/api/faults")) {
 332    handle_fault_request(req, res);
 433  } else if (strstr(req->path, "/api/alerts")) {
 134    res->status_code = 200;
 135    strcpy(res->content_type, "application/json");
 136    char *json = alert_service_serialize_alerts();
 137    strncpy(res->body, json, 8191);
 138    res->body[8191] = '\0';
 139    free(json);
 40  }
 2241}

Methods/Properties