initial commit

This commit is contained in:
dl92
2026-01-06 15:05:27 +00:00
parent a94f174a39
commit 62ab80b1d6
25 changed files with 1291 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
#include <gtest/gtest.h>
#include "../src/calculator.h" // Include the header for the class we are testing
// Test fixture for Calculator class
class CalculatorTest : public ::testing::Test {
protected:
Calculator calc;
};
// Test case for the add method
TEST_F(CalculatorTest, Add) {
EXPECT_EQ(calc.add(2, 2), 4);
EXPECT_EQ(calc.add(-1, 1), 0);
EXPECT_EQ(calc.add(-5, -5), -10);
}
// Another test case for the add method for good measure
TEST_F(CalculatorTest, AddWithZero) {
EXPECT_EQ(calc.add(0, 5), 5);
EXPECT_EQ(calc.add(5, 0), 5);
EXPECT_EQ(calc.add(0, 0), 0);
}