-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.cpp
41 lines (33 loc) · 919 Bytes
/
test.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
//
// Created by sages on 10/10/2018.
//
#include "gtest/gtest.h"
#include "calculatorclass.h"
TEST(CalculatorTestcase,addTest){
calc::Calculator calculator{};
ASSERT_EQ(0,calculator.add(0,0));
}
TEST(CalculatorTestcase,subtractTest){
calc::Calculator calculator{};
ASSERT_EQ(0,calculator.subtract(0,0));
}
TEST(CalculatorTestcase,divideTestLogicError){
calc::Calculator calculator{};
ASSERT_ANY_THROW(calculator.divide(5,0));
}
TEST(CalculatorTestcase,divideTest){
calc::Calculator calculator{};
ASSERT_ANY_THROW(calculator.divide(5,0));
}
TEST(CalculatorTestcase,multiplyTest){
calc::Calculator calculator{};
ASSERT_EQ(0,calculator.multiply(0,0));
}
TEST(CalculatorTestcase,squareTest){
calc::Calculator calculator{};
ASSERT_EQ(0,calculator.square(0));
}
int main(int argc, char** argv) {
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}