summaryrefslogtreecommitdiffhomepage
path: root/test-cpp.cpp
diff options
context:
space:
mode:
authorRoland Reichwein <mail@reichwein.it>2020-10-24 16:32:18 +0200
committerRoland Reichwein <mail@reichwein.it>2020-10-24 16:32:18 +0200
commit1011655d2ef76a0c0aa29dbbff091dab139198e3 (patch)
tree63763828f259846f56285691805c187583ecb6bb /test-cpp.cpp
parent1349c00b782eca3ea841bfa388301cb6fc908cc7 (diff)
Add FlowGraph
Diffstat (limited to 'test-cpp.cpp')
-rw-r--r--test-cpp.cpp78
1 files changed, 0 insertions, 78 deletions
diff --git a/test-cpp.cpp b/test-cpp.cpp
deleted file mode 100644
index 513a3a5..0000000
--- a/test-cpp.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-#include "bnf.h"
-#include "cpp.h"
-#include "cppbnf.h"
-#include "lexer.h"
-#include "grammer.h"
-#include "minicc.h"
-#include "debug.h"
-
-#include <boost/algorithm/string.hpp>
-
-#include "gmock/gmock.h"
-#include "gtest/gtest.h"
-
-#include <algorithm>
-#include <cctype>
-#include <deque>
-#include <map>
-#include <memory>
-#include <string>
-#include <utility>
-#include <vector>
-
-class CppTest: public ::testing::Test
-{
-protected:
- CppTest() {
- debug = true;
- }
- ~CppTest() {
- }
-};
-
-TEST_F(CppTest, preprocessing_tokenize) {
- CPP cpp;
- auto pp_tokens = cpp.preprocessing_tokenize("int main() { return 1; }");
-
- ASSERT_EQ(pp_tokens.size(), 9);
-
- auto tokens = cpp.tokens_from_pptokens(pp_tokens);
-
- ASSERT_EQ(tokens.size(), 9);
-
- auto nodes = cpp.analysis(tokens);
-
- ASSERT_EQ(nodes.size(), 60/*44*/);
-}
-
-TEST_F(CppTest, preprocessing_tokenize_compile_error) {
- CPP cpp;
- auto ppTree = cpp.preprocessing_tokenize("in ma");
-
- auto tokens = cpp.tokens_from_pptokens(ppTree);
-
- ASSERT_EQ(tokens.size(), 2);
-
- try {
- auto nodes = cpp.analysis(tokens);
- } catch (const std::exception& ex) {
- EXPECT_EQ(ex.what(), "Compile error"s);
- return;
- }
-
- FAIL() << "Exception expected";
-}
-
-TEST(Cpp, compile) {
- CPP cpp;
-
- cpp.compile("int main() { return 1 + 1; }");
-}
-
-TEST(Cpp, compile_2_times) {
- CPP cpp;
-
- cpp.compile("int main() { return (1 + 2) * 2; }");
- cpp.compile("int main() { return 1 + 2 * 2; }");
-}
-