Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New unit tests #284

Merged
merged 10 commits into from
Nov 6, 2023
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/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/TestsApp/TestsApp


16 changes: 14 additions & 2 deletions apps/TestsApp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,21 @@
project(TestsApp)

# 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})
19 changes: 0 additions & 19 deletions apps/TestsApp/include/TestsApp/Example.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "AutomatonToImage/AutomatonToImage.h"

Check failure on line 1 in apps/TestsApp/include/TestsApp/Example.h

View workflow job for this annotation

GitHub Actions / cpp-linter

/apps/TestsApp/include/TestsApp/Example.h:1:10 [clang-diagnostic-error]

'AutomatonToImage/AutomatonToImage.h' file not found
#include "InputGenerator/RegexGenerator.h"
#include "InputGenerator/TasksGenerator.h"
#include "Interpreter/Interpreter.h"
Expand All @@ -17,7 +17,7 @@
использования функций и, соответственно, их тестить.
Чтобы оставлять чистым main
*/
class Example {

Check warning on line 20 in apps/TestsApp/include/TestsApp/Example.h

View workflow job for this annotation

GitHub Actions / cpp-linter

/apps/TestsApp/include/TestsApp/Example.h:20:7 [cppcoreguidelines-avoid-non-const-global-variables]

variable 'Example' is non-const and globally accessible, consider making it const
public:
/*запуск всех примеров*/
static void all_examples();
Expand All @@ -27,7 +27,6 @@
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 @@
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();
};
Loading