-
Notifications
You must be signed in to change notification settings - Fork 0
/
sub_test.hpp
39 lines (30 loc) · 886 Bytes
/
sub_test.hpp
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
#ifndef __SUB_TEST_HPP__
#define __SUB_TEST_HPP__
#include "gtest/gtest.h"
#include "op.hpp"
#include "sub.hpp"
TEST(SubTest, SubTwelve) {
Op* num1 = new Op(4);
Op* num2 = new Op(8);
Sub* test = new Sub(num1, num2);
EXPECT_EQ(test->evaluate(), -4);
}
TEST(StringTest, SubTwelve) {
Op* num1 = new Op(4);
Op* num2 = new Op(8);
Sub* test = new Sub(num1, num2);
EXPECT_EQ(test->stringify(), "(4.000000 - 8.000000)");
}
TEST(SubNegative, SubTen) {
Op* num1 = new Op(4);
Op* num2 = new Op(-6);
Sub* test = new Sub(num1, num2);
EXPECT_EQ(test->evaluate(), 10);
}
TEST(StringNegative, SubTen) {
Op* num1 = new Op(4);
Op* num2 = new Op(-6);
Sub* test = new Sub(num1, num2);
EXPECT_EQ(test->stringify(), "(4.000000 - -6.000000)");
}
#endif //__SUB_TEST_HPP__