Skip to content

Commit

Permalink
Merge pull request #293 from OnionGrief/parsing_regex
Browse files Browse the repository at this point in the history
Parsing negative regex
  • Loading branch information
xendalm authored Nov 10, 2023
2 parents c7219a5 + 0684467 commit 8034b57
Show file tree
Hide file tree
Showing 25 changed files with 863 additions and 564 deletions.
3 changes: 2 additions & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ AllowShortIfStatementsOnASingleLine: Never
SpaceBeforeParens: ControlStatements
AllowShortFunctionsOnASingleLine: Empty
AlignAfterOpenBracket: Align
ColumnLimit: 100
ColumnLimit: 100
BinPackArguments: false
8 changes: 0 additions & 8 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,5 @@ jobs:
- name: Build
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build

- name: Test
#working-directory: ${{github.workspace}}/build/apps/TestsApp
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
# ну почему не из корня ...
#run: ctest -C ${{env.BUILD_TYPE}}
run: ./build/apps/TestsApp/TestsApp


35 changes: 35 additions & 0 deletions .github/workflows/integrationTests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: IntegrationTests

on: [ push ]

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release

jobs:
build:
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
# You can convert this to a matrix build if you need cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -B ${{github.workspace}}/build

- name: Build
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build

- name: Test
#working-directory: ${{github.workspace}}/build/apps/TestsApp
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
# ну почему не из корня ...
#run: ctest -C ${{env.BUILD_TYPE}}
run: ./build/apps/IntegrationTestsApp/IntegrationTestsApp


35 changes: 35 additions & 0 deletions .github/workflows/metamorphicTests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: MetamorphicTests

on: [ push ]

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release

jobs:
build:
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
# You can convert this to a matrix build if you need cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -B ${{github.workspace}}/build

- name: Build
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build

- name: Test
#working-directory: ${{github.workspace}}/build/apps/TestsApp
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
# ну почему не из корня ...
#run: ctest -C ${{env.BUILD_TYPE}}
run: ./build/apps/MetamorphicTestsApp/MetamorphicTestsApp


35 changes: 35 additions & 0 deletions .github/workflows/unitTests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: UnitTests

on: [ push ]

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release

jobs:
build:
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
# You can convert this to a matrix build if you need cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -B ${{github.workspace}}/build

- name: Build
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build

- name: Test
#working-directory: ${{github.workspace}}/build/apps/TestsApp
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
# ну почему не из корня ...
#run: ctest -C ${{env.BUILD_TYPE}}
run: ./build/apps/UnitTestsApp/UnitTestsApp


4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@ add_subdirectory(libs/Interpreter)
add_subdirectory(libs/InputGenerator)
add_subdirectory(apps/InterpreterApp)
add_subdirectory(apps/InputGeneratorApp)
add_subdirectory(apps/TestsApp)
add_subdirectory(apps/UnitTestsApp)
add_subdirectory(apps/IntegrationTestsApp)
add_subdirectory(apps/MetamorphicTestsApp)
37 changes: 37 additions & 0 deletions apps/IntegrationTestsApp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Set the project name
project(IntegrationTestsApp)

# Create a sources variable with a link to all cpp files to compile

include(FetchContent)
FetchContent_Declare(
googletest
URL https://github.com/google/googletest/archive/03597a01ee50ed33e9dfd640b249b4be3799d395.zip
)

set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)

set(SOURCES
src/main.cpp
src/IntegrationTests.cpp)


# Add a library with the above sources
add_executable(${PROJECT_NAME} ${SOURCES})

target_include_directories(${PROJECT_NAME}
PUBLIC ${PROJECT_SOURCE_DIR}/include
)

target_link_libraries(${PROJECT_NAME}
InputGenerator
Interpreter
Tester
Objects
gtest
)

enable_testing()
add_test(NAME IntegrationTests
COMMAND ${PROJECT_NAME})
1 change: 1 addition & 0 deletions apps/IntegrationTestsApp/src/IntegrationTests.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "gtest/gtest.h"
11 changes: 11 additions & 0 deletions apps/IntegrationTestsApp/src/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include "gtest/gtest.h"
#include <iostream>
#include <thread>
using namespace std;

int main(int argc, char** argv) {
cout << "Integration Tests\n";
// Тестирование
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
37 changes: 37 additions & 0 deletions apps/MetamorphicTestsApp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Set the project name
project(MetamorphicTestsApp)

# Create a sources variable with a link to all cpp files to compile

include(FetchContent)
FetchContent_Declare(
googletest
URL https://github.com/google/googletest/archive/03597a01ee50ed33e9dfd640b249b4be3799d395.zip
)

set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)

set(SOURCES
src/main.cpp
src/MetamorphicTests.cpp)


# Add a library with the above sources
add_executable(${PROJECT_NAME} ${SOURCES})

target_include_directories(${PROJECT_NAME}
PUBLIC ${PROJECT_SOURCE_DIR}/include
)

target_link_libraries(${PROJECT_NAME}
InputGenerator
Interpreter
Tester
Objects
gtest
)

enable_testing()
add_test(NAME IntegrationTests
COMMAND ${PROJECT_NAME})
1 change: 1 addition & 0 deletions apps/MetamorphicTestsApp/src/MetamorphicTests.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "gtest/gtest.h"
11 changes: 11 additions & 0 deletions apps/MetamorphicTestsApp/src/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include "gtest/gtest.h"
#include <iostream>
#include <thread>
using namespace std;

int main(int argc, char** argv) {
cout << "Metamorphic Tests\n";
// Тестирование
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
11 changes: 0 additions & 11 deletions apps/TestsApp/src/main.cpp

This file was deleted.

18 changes: 15 additions & 3 deletions apps/TestsApp/CMakeLists.txt → apps/UnitTestsApp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
# Set the project name
project(TestsApp)
project(UnitTestsApp)

# Create a sources variable with a link to all cpp files to compile

include(FetchContent)
FetchContent_Declare(
googletest
URL https://github.com/google/googletest/archive/03597a01ee50ed33e9dfd640b249b4be3799d395.zip
)

set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)

set(SOURCES
src/Example.cpp
src/main.cpp)
src/main.cpp
src/UnitTests.cpp)


# Add a library with the above sources
add_executable(${PROJECT_NAME} ${SOURCES})
Expand All @@ -18,9 +30,9 @@ target_link_libraries(${PROJECT_NAME}
Interpreter
Tester
Objects
gtest
)

enable_testing()

add_test(NAME UnitTests
COMMAND ${PROJECT_NAME})
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ class Example {
static void intersection();
static void regex_parsing();
static void regex_generating();
static void random_regex_parsing();
static void tasks_generating();
static void parsing_regex(string);
static void transformation_monoid_example();
Expand All @@ -48,22 +47,4 @@ class Example {
static void arden_lemma_testing();
static void fa_to_pgrammar();
static void logger_test();

// запуск всех тестов
static void test_all();
static void test_fa_equal();
static void test_fa_equiv();
static void test_bisimilar();
static void test_regex_subset();
static void test_merge_bisimilar();
static void test_regex_equal();
static void test_ambiguity();
static void test_arden();
static void test_pump_length();
static void test_is_one_unambiguous();
static void test_get_one_unambiguous_regex();
static void test_interpreter();
static void test_TransformationMonoid();
static void test_GlaisterShallit();
static void test_fa_to_pgrammar();
};
29 changes: 29 additions & 0 deletions apps/UnitTestsApp/include/UnitTestsApp/UnitTests.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#pragma once

#include "AutomatonToImage/AutomatonToImage.h"
#include "InputGenerator/RegexGenerator.h"
#include "Interpreter/Interpreter.h"
#include "Objects/AlgExpression.h"
#include "Objects/FiniteAutomaton.h"
#include "Objects/Grammar.h"
#include "Objects/Language.h"
#include "Objects/Regex.h"
#include "Objects/TransformationMonoid.h"
#include "Tester/Tester.h"
#include "gtest/gtest.h"
#include <functional>

class UnitTests
{
public:
UnitTests(){};

static int RunTests(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
};

using Lexeme = AlgExpression::Lexeme;
using LexemeType = AlgExpression::Lexeme::Type;
static std::vector<Lexeme> parse_string(std::string str) {return AlgExpression::parse_string(str);};
};
Loading

0 comments on commit 8034b57

Please sign in to comment.