Skip to content

Commit

Permalink
change tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Мамедов Кенан Эльчин Оглы committed Sep 29, 2024
1 parent d3bb09c commit a4abab2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
8 changes: 4 additions & 4 deletions include/circle.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@ class Circle {
double area;

void updateFerence() {
ference = 2 * 3.141592653589793 * radius;
ference = 2 * M_PI * radius;
}

void updateArea() {
area = 3.141592653589793 * radius * radius;
area = M_PI * radius * radius;
}

void updateRadiusFromFerence() {
radius = ference / (2 * 3.141592653589793);
radius = ference / (2 * M_PI);
}

void updateRadiusFromArea() {
radius = std::sqrt(area / 3.141592653589793);
radius = std::sqrt(area / M_PI);
}

public:
Expand Down
10 changes: 7 additions & 3 deletions test/tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ TEST(CircleTest, SetRadius) {

TEST(CircleTest, SetFerence) {
Circle c(5.0);
c.setFerence(31.4159);
c.setFerence(2 * M_PI * 5.0);
EXPECT_NEAR(c.getRadius(), 5.0, 0.0001);
EXPECT_NEAR(c.getArea(), 78.5398, 0.0001);
EXPECT_NEAR(c.getArea(), M_PI * 5.0 * 5.0, 0.0001);
}

TEST(CircleTest, SetArea) {
Expand All @@ -59,7 +59,11 @@ TEST(TaskTest, PoolCostTest) {

double totalCost = calculateCostOfPoolAndPath(poolRadius,
pathWidth, concreteCost, fenceCost);
EXPECT_NEAR(totalCost, 65973.4457, 0.0001);
double expectedConcreteCost = 1000 * M_PI * ((poolRadius + pathWidth) *
(poolRadius + pathWidth) - poolRadius * poolRadius);
double expectedFenceCost = 2000 * 2 * M_PI * (poolRadius + pathWidth);
double expectedTotalCost = expectedConcreteCost + expectedFenceCost;
EXPECT_NEAR(totalCost, expectedTotalCost, 0.0001);
}

TEST(CircleTest, NegativeRadius) {
Expand Down

0 comments on commit a4abab2

Please sign in to comment.