-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmult_test.hpp
37 lines (29 loc) · 890 Bytes
/
mult_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
#ifndef __MULT_TEST_HPP__
#define _MULT_TEST_HPP__
#include "gtest/gtest.h"
#include "mult.hpp"
TEST(MultTest, MultEvaluateNonZero) {
Base* eight = new Op(8);
Base* five = new Op(5);
Mult* test = new Mult(eight, five);
EXPECT_EQ(test->evaluate(), 40);
}
TEST(MultTest, MultEvaluateNegative) {
Base* negEight = new Op(-8);
Base* five = new Op(5);
Mult* test = new Mult(negEight, five);
EXPECT_EQ(test->evaluate(), -40);
}
TEST(MultTest, MultStringifyTwoOps) {
Base* eight = new Op(8);
Base* five = new Op(5);
Mult* test = new Mult(eight, five);
EXPECT_EQ(test->stringify(), "(8.000000 * 5.000000)");
}
TEST(MultTest, MultStringifyNegative) {
Base* negEight = new Op(-8);
Base* five = new Op(5);
Mult* test = new Mult(negEight, five);
EXPECT_EQ(test->stringify(), "(-8.000000 * 5.000000)");
}
#endif //__MULT_TEST_HPP__