Commit 1bae1081 authored by Jaime Arias's avatar Jaime Arias
Browse files

Fix CMakeLists files. Add examples folder for test

parent da3fab70
......@@ -4,7 +4,12 @@ cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
# project name and language
project(pn-parser LANGUAGES CXX)
# variables
set(SRC_DIR "${PROJECT_SOURCE_DIR}/src")
set(EXAMPLES_DIR "${PROJECT_SOURCE_DIR}/examples")
# add source folder
include_directories (${SRC_DIR})
add_subdirectory(src)
# add tests
......
# set minimum cmake version
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
# project name and language
# compilator flags
project(pn-parser-src LANGUAGES CXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -Wall")
# dependencies
find_package(BISON REQUIRED)
find_package(FLEX REQUIRED)
# execute bison and flex
bison_target(rdp_parser RdPMonteur.y ${CMAKE_CURRENT_BINARY_DIR}/parser.c)
flex_target(rdp_scanner RdPMonteur.l ${CMAKE_CURRENT_BINARY_DIR}/lexer.c)
add_flex_bison_dependency(rdp_scanner rdp_parser)
# execute bison
BISON_TARGET(
RdPMonteurParser
RdPMonteur.y ${CMAKE_CURRENT_BINARY_DIR}/RdPMonteur.tab.cpp
)
# execute flex
FLEX_TARGET(
RdPMonteurLexer
RdPMonteur.l ${CMAKE_CURRENT_BINARY_DIR}/RdPMonteur.lex.cpp
)
ADD_FLEX_BISON_DEPENDENCY(RdPMonteurLexer RdPMonteurParser)
# generate a the library from sources
set(CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON)
add_library(RdP
STATIC
Net.h
add_library(RdP STATIC
${BISON_RdPMonteurParser_OUTPUTS}
${FLEX_RdPMonteurLexer_OUTPUTS}
Net.hpp
Net.cpp
RdPMonteur.h
${BISON_rdp_parser_OUTPUTS}
${FLEX_rdp_scanner_OUTPUTS}
RdPMonteur.hpp
)
#include "Net.h"
#include "Net.hpp"
#include <algorithm>
#include <ext/hash_map>
#include <iomanip>
......
......@@ -8,7 +8,7 @@
#include <set>
#include <string>
#include <vector>
#include "RdPMonteur.h"
#include "RdPMonteur.hpp"
typedef set<int> Set;
class Node {
public:
......
%{
/************* INCLUDES AND EXTERNALS *************************************/
extern "C" int yylex();
#include <stdio.h>
#include <string.h>
#include "RdPMonteur.tab.h"
#include "RdPMonteur.tab.hpp"
%}
......
......@@ -4,7 +4,7 @@
#include <string>
#include <stdio.h>
#include "RdPMonteur.h"
#include "RdPMonteur.hpp"
static RdPMonteur *R;
static string t;
......
......@@ -11,5 +11,6 @@ target_link_libraries(RdPtest RdP)
# Add test
add_test(
NAME tests
WORKING_DIRECTORY ${EXAMPLES_DIR}
COMMAND RdPtest
)
#define CATCH_CONFIG_MAIN
#include "Net.h"
#include "Net.hpp"
#include "catch.hpp"
TEST_CASE("Parsing simple file", "[Simple]") {
net R("../examples/ring2.net", "../examples/Obs2_ring", "");
net model("ring2.net", "Obs2_ring");
REQUIRE(model.nbPlace() == 16);
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment