-
Notifications
You must be signed in to change notification settings - Fork 0
/
expression_tests.cpp
48 lines (33 loc) · 983 Bytes
/
expression_tests.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
42
43
44
45
46
47
#include "catch.hpp"
#include "expression.hpp"
TEST_CASE( "Test default expression", "[expression]" ) {
Expression exp;
REQUIRE(!exp.isHeadNumber());
REQUIRE(!exp.isHeadSymbol());
}
TEST_CASE( "Test double expression", "[expression]" ) {
Expression exp(6.023);
REQUIRE(exp.isHeadNumber());
REQUIRE(!exp.isHeadSymbol());
}
TEST_CASE( "Test symbol expression", "[expression]" ) {
Expression exp(Atom("asymbol"));
REQUIRE(!exp.isHeadNumber());
REQUIRE(exp.isHeadSymbol());
REQUIRE(exp.isTailEmpty());
}
TEST_CASE("Test Head and Tail of Expression", "[expression]")
{
Expression exp;
exp.pushback(Expression(Atom(5)));
exp.pushback(Expression(Atom(2)));
exp.pushback(Expression(Atom(3)));
exp.pushback(Expression(Atom(4)));
Expression exp1;
exp1.pushback(Expression(Atom(5)));
exp1.pushback(Expression(Atom(2)));
exp1.pushback(Expression(Atom(3)));
exp1.pushback(Expression(Atom(4)));
Expression exp2;
exp2.pushback(Expression(Atom(5)));
}