GCC Code Coverage Report


Directory: src/
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 0.0% 0 / 0 / 12
Functions: 0.0% 0 / 0 / 1
Branches: 0.0% 0 / 0 / 20

calculatorapp/src/calculatorapp.cpp
Line Branch Exec Source
1 /**
2 * @file calculatorapp.cpp
3 * @brief A simple program to demonstrate the usage of the calculator library.
4 *
5 * Reads one infix expression from standard input, parses and evaluates it
6 * with Coruh::Calculator::ExpressionParser (library code, unit tested under
7 * src/tests/calculator), and prints the result. All expression parsing logic
8 * lives in the calculator library, not here, so it can be unit tested.
9 */
10
11 // Standard Libraries
12 #include <iostream>
13 #include <stdexcept>
14 #include <string>
15
16 #include "../../calculator/header/expressionParser.h"
17
18 using namespace Coruh::Calculator;
19
20 ✗ int main() {
21 ✗ std::string infix;
22
23 ✗ std::cout << "Enter an infix expression: ";
24 ✗ std::getline(std::cin, infix);
25
26 try {
27 ✗ double result = ExpressionParser::evaluateInfix(infix);
28 ✗ std::cout << "Result: " << result << std::endl;
29 ✗ } catch(const std::invalid_argument& e) {
30 ✗ std::cerr << "Error: " << e.what() << std::endl;
31 ✗ return 1;
32 ✗ }
33
34 ✗ return 0;
35 ✗ }
36