calculator (Windows) - unit tests 1.1.1
calculator - Unit Tests
Loading...
Searching...
No Matches
Classes | Functions
expressionParser_test.cpp File Reference
#include "gtest/gtest.h"
#include "../../calculator/header/expressionParser.h"
#include <stdexcept>
Include dependency graph for expressionParser_test.cpp:

Go to the source code of this file.

Classes

class  ExpressionParserTest
 

Functions

 TEST_F (ExpressionParserTest, AddsTwoIntegers)
 
 TEST_F (ExpressionParserTest, SubtractsTwoIntegers)
 
 TEST_F (ExpressionParserTest, MultipliesTwoIntegers)
 
 TEST_F (ExpressionParserTest, DividesTwoIntegers)
 
 TEST_F (ExpressionParserTest, HandlesMultiDigitNumbers)
 
 TEST_F (ExpressionParserTest, IgnoresWhitespaceBetweenTokens)
 
 TEST_F (ExpressionParserTest, MultiplicationBindsTighterThanAddition)
 
 TEST_F (ExpressionParserTest, DivisionBindsTighterThanSubtraction)
 
 TEST_F (ExpressionParserTest, SameLevelOperatorsAreLeftAssociative)
 
 TEST_F (ExpressionParserTest, ParenthesesOverridePrecedence)
 
 TEST_F (ExpressionParserTest, NestedParenthesesAreSupported)
 
 TEST_F (ExpressionParserTest, AddsDecimalNumbers)
 
 TEST_F (ExpressionParserTest, HandlesLeadingAndTrailingDecimalPoint)
 
 TEST_F (ExpressionParserTest, DecimalPrecisionIsPreserved)
 
 TEST_F (ExpressionParserTest, EmptyExpressionThrows)
 
 TEST_F (ExpressionParserTest, WhitespaceOnlyExpressionThrows)
 
 TEST_F (ExpressionParserTest, ExpressionEndingWithOperatorThrows)
 
 TEST_F (ExpressionParserTest, MissingLeftOperandThrows)
 
 TEST_F (ExpressionParserTest, TwoNumbersWithoutOperatorThrows)
 
 TEST_F (ExpressionParserTest, MissingOperatorBeforeParenthesisThrows)
 
 TEST_F (ExpressionParserTest, EmptyParenthesesThrow)
 
 TEST_F (ExpressionParserTest, OperatorBeforeClosingParenthesisThrows)
 
 TEST_F (ExpressionParserTest, UnmatchedClosingParenthesisThrows)
 
 TEST_F (ExpressionParserTest, UnmatchedOpeningParenthesisThrows)
 
 TEST_F (ExpressionParserTest, TwoDecimalPointsInOneNumberThrows)
 
 TEST_F (ExpressionParserTest, LoneDecimalPointThrows)
 
 TEST_F (ExpressionParserTest, UnexpectedCharacterThrows)
 
 TEST_F (ExpressionParserTest, UnsupportedOperatorCharacterThrows)
 
 TEST_F (ExpressionParserTest, DivisionByZeroThrows)
 
 TEST_F (ExpressionParserTest, EvaluatePostfixWithTooFewOperandsThrows)
 
 TEST_F (ExpressionParserTest, EvaluatePostfixWithLeftoverOperandsThrows)
 
 TEST_F (ExpressionParserTest, EvaluatePostfixWithInvalidTokenThrows)
 
 TEST_F (ExpressionParserTest, ToPostfixProducesReversePolishNotation)
 

Function Documentation

◆ TEST_F() [1/33]

TEST_F ( ExpressionParserTest ,
AddsDecimalNumbers  )

Definition at line 90 of file expressionParser_test.cpp.

◆ TEST_F() [2/33]

TEST_F ( ExpressionParserTest ,
AddsTwoIntegers  )

Definition at line 30 of file expressionParser_test.cpp.

◆ TEST_F() [3/33]

TEST_F ( ExpressionParserTest ,
DecimalPrecisionIsPreserved  )

Definition at line 99 of file expressionParser_test.cpp.

◆ TEST_F() [4/33]

TEST_F ( ExpressionParserTest ,
DividesTwoIntegers  )

Definition at line 42 of file expressionParser_test.cpp.

◆ TEST_F() [5/33]

TEST_F ( ExpressionParserTest ,
DivisionBindsTighterThanSubtraction  )

Definition at line 63 of file expressionParser_test.cpp.

◆ TEST_F() [6/33]

TEST_F ( ExpressionParserTest ,
DivisionByZeroThrows  )

Definition at line 170 of file expressionParser_test.cpp.

◆ TEST_F() [7/33]

TEST_F ( ExpressionParserTest ,
EmptyExpressionThrows  )

Definition at line 107 of file expressionParser_test.cpp.

◆ TEST_F() [8/33]

TEST_F ( ExpressionParserTest ,
EmptyParenthesesThrow  )

Definition at line 132 of file expressionParser_test.cpp.

◆ TEST_F() [9/33]

TEST_F ( ExpressionParserTest ,
EvaluatePostfixWithInvalidTokenThrows  )

Definition at line 187 of file expressionParser_test.cpp.

◆ TEST_F() [10/33]

TEST_F ( ExpressionParserTest ,
EvaluatePostfixWithLeftoverOperandsThrows  )

Definition at line 183 of file expressionParser_test.cpp.

◆ TEST_F() [11/33]

TEST_F ( ExpressionParserTest ,
EvaluatePostfixWithTooFewOperandsThrows  )

Definition at line 179 of file expressionParser_test.cpp.

◆ TEST_F() [12/33]

TEST_F ( ExpressionParserTest ,
ExpressionEndingWithOperatorThrows  )

Definition at line 115 of file expressionParser_test.cpp.

◆ TEST_F() [13/33]

TEST_F ( ExpressionParserTest ,
HandlesLeadingAndTrailingDecimalPoint  )

Definition at line 94 of file expressionParser_test.cpp.

◆ TEST_F() [14/33]

TEST_F ( ExpressionParserTest ,
HandlesMultiDigitNumbers  )

Definition at line 46 of file expressionParser_test.cpp.

◆ TEST_F() [15/33]

TEST_F ( ExpressionParserTest ,
IgnoresWhitespaceBetweenTokens  )

Definition at line 50 of file expressionParser_test.cpp.

◆ TEST_F() [16/33]

TEST_F ( ExpressionParserTest ,
LoneDecimalPointThrows  )

Definition at line 152 of file expressionParser_test.cpp.

◆ TEST_F() [17/33]

TEST_F ( ExpressionParserTest ,
MissingLeftOperandThrows  )

Definition at line 119 of file expressionParser_test.cpp.

◆ TEST_F() [18/33]

TEST_F ( ExpressionParserTest ,
MissingOperatorBeforeParenthesisThrows  )

Definition at line 128 of file expressionParser_test.cpp.

◆ TEST_F() [19/33]

TEST_F ( ExpressionParserTest ,
MultiplicationBindsTighterThanAddition  )

Definition at line 58 of file expressionParser_test.cpp.

◆ TEST_F() [20/33]

TEST_F ( ExpressionParserTest ,
MultipliesTwoIntegers  )

Definition at line 38 of file expressionParser_test.cpp.

◆ TEST_F() [21/33]

TEST_F ( ExpressionParserTest ,
NestedParenthesesAreSupported  )

Definition at line 81 of file expressionParser_test.cpp.

◆ TEST_F() [22/33]

TEST_F ( ExpressionParserTest ,
OperatorBeforeClosingParenthesisThrows  )

Definition at line 136 of file expressionParser_test.cpp.

◆ TEST_F() [23/33]

TEST_F ( ExpressionParserTest ,
ParenthesesOverridePrecedence  )

Definition at line 76 of file expressionParser_test.cpp.

◆ TEST_F() [24/33]

TEST_F ( ExpressionParserTest ,
SameLevelOperatorsAreLeftAssociative  )

Definition at line 67 of file expressionParser_test.cpp.

◆ TEST_F() [25/33]

TEST_F ( ExpressionParserTest ,
SubtractsTwoIntegers  )

Definition at line 34 of file expressionParser_test.cpp.

◆ TEST_F() [26/33]

TEST_F ( ExpressionParserTest ,
ToPostfixProducesReversePolishNotation  )

Definition at line 195 of file expressionParser_test.cpp.

◆ TEST_F() [27/33]

TEST_F ( ExpressionParserTest ,
TwoDecimalPointsInOneNumberThrows  )

Definition at line 148 of file expressionParser_test.cpp.

◆ TEST_F() [28/33]

TEST_F ( ExpressionParserTest ,
TwoNumbersWithoutOperatorThrows  )

Definition at line 124 of file expressionParser_test.cpp.

◆ TEST_F() [29/33]

TEST_F ( ExpressionParserTest ,
UnexpectedCharacterThrows  )

Definition at line 157 of file expressionParser_test.cpp.

◆ TEST_F() [30/33]

TEST_F ( ExpressionParserTest ,
UnmatchedClosingParenthesisThrows  )

Definition at line 140 of file expressionParser_test.cpp.

◆ TEST_F() [31/33]

TEST_F ( ExpressionParserTest ,
UnmatchedOpeningParenthesisThrows  )

Definition at line 144 of file expressionParser_test.cpp.

◆ TEST_F() [32/33]

TEST_F ( ExpressionParserTest ,
UnsupportedOperatorCharacterThrows  )

Definition at line 166 of file expressionParser_test.cpp.

◆ TEST_F() [33/33]

TEST_F ( ExpressionParserTest ,
WhitespaceOnlyExpressionThrows  )

Definition at line 111 of file expressionParser_test.cpp.