diff options
author | Andreas Stöckel <astoecke@techfak.uni-bielefeld.de> | 2014-10-16 00:39:35 +0000 |
---|---|---|
committer | andreas <andreas@daaaf23c-2e50-4459-9457-1e69db5a47bf> | 2014-10-16 00:39:35 +0000 |
commit | 0e426ff6dfb960c105908a437c435924e59eb822 (patch) | |
tree | 8e8080e478bf51c59bb1b7900c1abe96ffccf469 | |
parent | 5fcdd424d7bd798673b1b545f7f990aba65471a9 (diff) |
reorganized code
git-svn-id: file:///var/local/svn/basicwriter@58 daaaf23c-2e50-4459-9457-1e69db5a47bf
-rw-r--r-- | CMakeLists.txt | 56 | ||||
-rwxr-xr-x | build.sh | 4 | ||||
-rwxr-xr-x | clean.sh | 5 | ||||
-rw-r--r-- | dependencies.txt | 4 | ||||
-rw-r--r-- | src/main.cpp | 41 | ||||
-rw-r--r-- | test/core/model/RangeSet.cpp (renamed from test/model/RangeSet.cpp) | 2 | ||||
-rw-r--r-- | test/model/GraphNode.cpp | 51 | ||||
-rw-r--r-- | test/model/domain/Layer.cpp | 48 |
8 files changed, 22 insertions, 189 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 4a1a3e2..8c59356 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,9 +21,6 @@ PROJECT(basicwriter) CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9) -SET(CMAKE_AUTOMOC ON) -FIND_PACKAGE(Qt5Core REQUIRED) - # Option for enabling testing. Turn on with 'cmake -Dtest=ON'. OPTION(test "Build all tests." OFF) # Makes boolean 'test' available. @@ -54,50 +51,19 @@ INCLUDE_DIRECTORIES( src/ ) -# ousia_model library (containing the code of the most important data structures -# and deduction algorithms -- this code does not depend on Qt). -ADD_LIBRARY(ousia_model - src/model/GraphNode - src/model/domain/Domain - src/model/domain/Structure - src/model/domain/ClassCategory - src/model/domain/Class - src/model/domain/ClassReferenceSet - src/model/domain/ClassReference - src/model/domain/Layer - src/model/domain/AnnotationReference - src/model/domain/Field - src/model/domain/AnnotationCategory - src/model/domain/Annotation - src/model/types/Type -) - -# ousia_xml library (containing the XML serialization/deserializing code for the -# data structures defined in the ousia_model library) -ADD_LIBRARY(ousia_xml - src/xml/XmlReader -) - -TARGET_LINK_LIBRARIES(ousia_xml - ousia_model +# ousia_script library (containing the code of t +ADD_LIBRARY(ousia_script + src/core/script/Variant.cpp ) -# Link the ousia xml model against the core module of Qt5 -QT5_USE_MODULES(ousia_xml Core Script) - # Definition of the main program -ADD_EXECUTABLE(ousia - src/main -) +#ADD_EXECUTABLE(ousia +#) # Link the ousia executable against ousia_core -TARGET_LINK_LIBRARIES(ousia - ousia_model - ousia_xml -) - -# Link the ousia executable against the Widgets module of Qt5 -QT5_USE_MODULES(ousia Widgets) +#TARGET_LINK_LIBRARIES(ousia +# ousia_script +#) # If testing is enabled, build the unit tests IF(test) @@ -109,14 +75,12 @@ IF(test) # Add all unit test files ADD_EXECUTABLE(ousia_test - test/model/RangeSet - test/model/GraphNode + test/core/model/RangeSet ) TARGET_LINK_LIBRARIES(ousia_test ${GTEST_LIBRARIES} - ousia_model - ousia_xml + ousia_script ) # Register the unit test diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..18170aa --- /dev/null +++ b/build.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +cd build && cmake .. -Dtest=on && make && make test + diff --git a/clean.sh b/clean.sh new file mode 100755 index 0000000..718a5a7 --- /dev/null +++ b/clean.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +find build/ -depth -mindepth 1 -delete -print + +find -depth \( \( -name "*.aux" -o -name "*.snm" -o -name "*.out" -o -name "*.toc" -o -name "*.nav" -o -name "*.log" -o -name "*.backup" -o -name "*.bbl" -o -name "*.blg" -o -name "*~" \) -a \! \( -wholename "*.git/*" -o -wholename "*.svn" \) \) -delete -print diff --git a/dependencies.txt b/dependencies.txt index 1939fef..9957d04 100644 --- a/dependencies.txt +++ b/dependencies.txt @@ -1,6 +1,6 @@ The following packages have to be installed (for Fedora) - cmake -- qt5-qtbase-devel -- qt5-qtscript-devel +# - qt5-qtbase-devel (not needed for now) +# - qt5-qtscript-devel (not needed for now) diff --git a/src/main.cpp b/src/main.cpp deleted file mode 100644 index 3603b9c..0000000 --- a/src/main.cpp +++ /dev/null @@ -1,41 +0,0 @@ -#include <QApplication> -#include <QFile> -#include <QIODevice> -#include <QXmlStreamReader> -#include <QScriptEngine> -#include <QDebug> - -#include <vector> -#include <iostream> - -#include <xml/XmlReader.hpp> - -using namespace ousia::xml; - -int main(int argc, char *argv[]) -{ - QScriptEngine engine; - qDebug() << "JS Test: " << engine.evaluate("Test"); - - // Open the file given as first argument -// if (argc < 2) { -// std::cout << "No filename specified!" << std::endl; -// return 1; -// } - -// QFile file(argv[1]); -// if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { -// std::cout << "Error while opening file " << argv[1] << std::endl; -// return 1; -// } - - // Create the QXmlStreamReader instance -// QXmlStreamReader xml(&file); - - // Pass it to the XmlReader -// XmlReader xmlReader(xml); -// xmlReader.process(); - - return 0; -} - diff --git a/test/model/RangeSet.cpp b/test/core/model/RangeSet.cpp index d026025..4f04538 100644 --- a/test/model/RangeSet.cpp +++ b/test/core/model/RangeSet.cpp @@ -18,7 +18,7 @@ #include <gtest/gtest.h> -#include <model/RangeSet.hpp> +#include <core/model/RangeSet.hpp> namespace ousia { namespace model { diff --git a/test/model/GraphNode.cpp b/test/model/GraphNode.cpp deleted file mode 100644 index bdb633c..0000000 --- a/test/model/GraphNode.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* - Ousía - Copyright (C) 2014 Benjamin Paaßen, Andreas Stöckel - - 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/>. -*/ - -#include <gtest/gtest.h> - -#include <model/GraphNode.hpp> - -namespace ousia { -namespace model { - -// Make the protected constructor of GraphNode available -class TestGraphNode : public GraphNode { - -public: - TestGraphNode(GraphNodeType type, std::shared_ptr<GraphNode> parent, - const std::string &name) : - GraphNode(type, parent, name) - { - // Do nothing here - } - -}; - -TEST(GraphNodeTest, FullyQuallifiedNameTest) -{ - std::shared_ptr<GraphNode> nd1{new TestGraphNode( - GraphNodeType::Domain, nullptr, "node1")}; - std::shared_ptr<GraphNode> nd2{new TestGraphNode( - GraphNodeType::Domain, nd1, "node2")}; - - ASSERT_STREQ("node1.node2", nd2->getFullyQualifiedName().c_str()); -} - -} -} - diff --git a/test/model/domain/Layer.cpp b/test/model/domain/Layer.cpp deleted file mode 100644 index 89aeaa4..0000000 --- a/test/model/domain/Layer.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* - Ousía - Copyright (C) 2014 Benjamin Paaßen, Andreas Stöckel - - 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/>. -*/ - -#include <gtest/gtest.h> -#include <iostream> - -#include <model/domain/Layer.hpp> -#include <model/domain/Annotation.hpp> - -namespace ousia { -namespace domain{ - -TEST(LayerTest, AnnotationManagementTest) -{ - std::shared_ptr<Annotation> anno1{new Annotation("em1")}; - std::shared_ptr<Annotation> anno2{new Annotation("em2", anno1)}; - - Layer layer {"layer"}; - - std::vector<std::shared_ptr<Annotation>>& annos = layer.getAnnotations(); - - annos.push_back(anno1); - annos.push_back(anno2); - - std::vector<std::shared_ptr<Annotation>>& test_annos = layer.getAnnotations(); - - ASSERT_EQ(2, test_annos.size()); - ASSERT_EQ(anno1, test_annos[0]); - ASSERT_EQ(anno2, test_annos[1]); -} - -} -} |