Skip to content

minimise test compilation time; add test script and actions CI file #5

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

Merged
merged 3 commits into from
Apr 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/workflows/linux_check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: CI for Linux

on: push

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: build
run: |
mkdir build && cd build
cmake ../src
make
cd ..
- name: regression test
run: |
cd tests
pwd
ls -l
./run_tests.sh
5 changes: 5 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,17 @@ project("datalog-cpp")
# specify the C++ standard
set(CMAKE_CXX_STANDARD 17)

# unit-test library
add_library(tests_main STATIC ../tests/tests_main.cpp)

# types_test target
add_executable(types_test ../tests/types_test.cpp)
target_include_directories(types_test PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(types_test tests_main)
target_compile_definitions(types_test PUBLIC UNIX)

# variable_test target
add_executable(variable_test ../tests/variable_test.cpp)
target_include_directories(variable_test PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(variable_test tests_main)
target_compile_definitions(variable_test PUBLIC UNIX)
4 changes: 4 additions & 0 deletions tests/run_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
set -e
../build/types_test
../build/variable_test
3 changes: 3 additions & 0 deletions tests/tests_main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// tests-main.cpp
#define CATCH_CONFIG_MAIN
#include "catch.hpp"
3 changes: 0 additions & 3 deletions tests/types_test.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
// Let Catch provide main():
#define CATCH_CONFIG_MAIN

#include "catch.hpp"
#include "Datalog.h"

Expand Down
7 changes: 2 additions & 5 deletions tests/variable_test.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
// Let Catch provide main():
#define CATCH_CONFIG_MAIN

#include "catch.hpp"
#include "Variable.h"

Expand All @@ -18,9 +15,9 @@ bool boundVariableTest() {
}

TEST_CASE( "An new variable is unbound", "[variable]" ) {
REQUIRE( freeVariableTest() );
REQUIRE( freeVariableTest() == true );
}

TEST_CASE( "A variable with a value is bound", "[variable]" ) {
REQUIRE( freeVariableTest() );
REQUIRE( boundVariableTest() == true );
}