-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.cpp
42 lines (37 loc) · 1.46 KB
/
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
/*
* This file is part of props
* Copyright (c) 2017 props's authors
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#define BOOST_TEST_MODULE props
#define BOOST_TEST_MAIN
#define BOOST_TEST_DYN_LINK
#include <boost/test/unit_test.hpp>
#include "prop.h"
BOOST_AUTO_TEST_SUITE(props)
BOOST_AUTO_TEST_CASE(parseG1) {
char s1[] = "~P /\\ Q";
Expression *tmp = nullptr;
parse_expression(&tmp, s1);
BOOST_CHECK_EQUAL(tmp->type, AND);
BOOST_CHECK_EQUAL(tmp->left->type, NOT);
BOOST_CHECK_EQUAL(tmp->right->value, 'Q');
BOOST_CHECK_EQUAL(tmp->left->value, 0);
BOOST_CHECK_EQUAL(tmp->left->right->value, 'P');
}
BOOST_AUTO_TEST_CASE(parseE1) {
char s1[] = "~A /\\";
Expression *tmp = nullptr;
parse_expression(&tmp, s1);
BOOST_CHECK(tmp == nullptr);
}
BOOST_AUTO_TEST_SUITE_END()