Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

init calculator unit test #10

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
32 changes: 32 additions & 0 deletions test/project_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,37 @@ TEST_F(ProjectTest, Run) {
ASSERT_EQ(0, project_.run());
}

// TDD
// basic design calc(std::sting) -> double

TEST_F(ProjectTest, AddPositive) {
ASSERT_EQ(project_.calc("2 3 +"), 5);
}

TEST_F(ProjectTest, AddNegative) {
ASSERT_EQ(project_.calc("-2 -3 +"), -5);
}

TEST_F(ProjectTest, Substract) {
ASSERT_EQ(project_.calc("5 2 -"), 3);
}

TEST_F(ProjectTest, Multiply) {
ASSERT_EQ(project_.calc("3 7 *"), 21);
}

TEST_F(ProjectTest, Devide) {
ASSERT_EQ(project_.calc("21 7 /"), 3);
}

TEST_F(ProjectTest, MultiplyWithZero) {
ASSERT_EQ(project_.calc("21 0 *"), 0);
}

TEST_F(ProjectTest, DevideWithZero) {
ASSERT_EQ(project_.calc("21 0 /"), -1);
}
GoranShekerov marked this conversation as resolved.
Show resolved Hide resolved


} // namespace testing
} // namespace dev