Skip to content

Commit

Permalink
Update catch from v2.x to v3.x. CC Based on OS
Browse files Browse the repository at this point in the history
* macos-12 workflow

* test macos-latest-large

* macos-latest

* ubuntu-latest

* g++-13 -> g++

* macos-latest with g++ instead g++-13

* macos-latest only

* ubuntu-24.04 beta

* CC makefile variable

* macos-latest

* easier testing

* Upgrade Catch2 v2.x to 3.x

* ubuntu-latest, all tests

* c++17 standard

* c++14 standard

* ubuntu only

* macos-latest only

* ubuntu-latest

* g++ instead of alias

* test

* clang

* g++-13 test

* check os in makefile

* Add ubuntu-latest

* d

* d

* conditional CC

* delete catch files and add java tests
  • Loading branch information
0sak authored Jul 26, 2024
1 parent ed89fc5 commit 2a9b31b
Show file tree
Hide file tree
Showing 31 changed files with 11,840 additions and 290 deletions.
32 changes: 16 additions & 16 deletions .github/workflows/test_suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
name: Testing C-Runtime
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
os: [macos-latest, ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
Expand All @@ -25,18 +25,18 @@ jobs:
run: make test_clean ; make clean

languagefeatures:
name: Testing CBuilder (Java)
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
- name: Build with Gradle
run: ./gradlew test
name: Testing CBuilder (Java)
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
- name: Build with Gradle
run: ./gradlew test
9 changes: 5 additions & 4 deletions c-runtime/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export TESTDIR := $(realpath ./test)
export INCLUDEDIRTEST := $(realpath ./test/include)
export SRCDIRTEST := $(realpath ./test/src)

export C_FILES_TEST := $(wildcard ./test/src/test/*.c ./test/src/test/*/*.c* ./src/*.c ./src/*/*.c*)
export C_FILES_TEST := $(wildcard ./test/src/test/*.c ./test/src/test/*/*.c* ./test/src/*.cpp)
export C_FILES_TEST := $(filter-out ./src/program.c, $(C_FILES_TEST))
export C_FILES := $(wildcard ./src/*.c ./src/*/*.c*)
export C_FILES := $(filter-out ./src/program.c, $(C_FILES))
Expand Down Expand Up @@ -104,7 +104,8 @@ lint:
#https://github.com/catchorg/Catch2/blob/v2.x/include/catch.hpp
.PHONY: curl_catch
curl_catch:
curl -o $(TESTDIR)/include/catch.hpp https://raw.githubusercontent.com/catchorg/Catch2/v2.x/single_include/catch2/catch.hpp
curl -o $(TESTDIR)/include/catch_amalgamated.hpp https://raw.githubusercontent.com/catchorg/Catch2/devel/extras/catch_amalgamated.hpp
curl -o $(TESTDIR)/src/catch_amalgamated.cpp https://raw.githubusercontent.com/catchorg/Catch2/devel/extras/catch_amalgamated.cpp

.PHONY: test
test: curl_catch
Expand All @@ -130,11 +131,11 @@ test_run:
.PHONY: test_target
test_target: curl_catch
d=$$(date +%s)\
; make -f $(TESTDIR)/Systemtests/makefile test_greater_equal_op \
; make -f $(TESTDIR)/Systemtests/makefile test_declaration_and_assignment \
&& echo "Build took $$(($$(date +%s)-d)) seconds"
make run_target
make test_clean

.PHONY: run_target
run_target:
./test/Systemtests/ComparisonOps/TestGreaterEqualOp.out
./test/Systemtests/DeclarationAndAssignment/TestDeclarationAndAssignment.out
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <stddef.h>

#include "catch.hpp"
#include "catch_amalgamated.hpp"
#include "assert.h"
#include "mpy_aliases.h"
#include "mpy_obj.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <stddef.h>

#include "catch.hpp"
#include "catch_amalgamated.hpp"
#include "assert.h"
#include "mpy_aliases.h"
#include "mpy_obj.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <stddef.h>

#include "catch.hpp"
#include "catch_amalgamated.hpp"
#include "assert.h"
#include "mpy_aliases.h"
#include "mpy_obj.h"
Expand Down
2 changes: 1 addition & 1 deletion c-runtime/test/Systemtests/BuiltInFunctions/TestId.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#include <stddef.h>

#include "catch.hpp"
#include "catch_amalgamated.hpp"
#include "assert.h"
#include "mpy_aliases.h"
#include "mpy_obj.h"
Expand Down
2 changes: 1 addition & 1 deletion c-runtime/test/Systemtests/BuiltInFunctions/TestPrint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include <stddef.h>

#include "catch.hpp"
#include "catch_amalgamated.hpp"
#include "assert.h"
#include "mpy_aliases.h"
#include "mpy_obj.h"
Expand Down
2 changes: 1 addition & 1 deletion c-runtime/test/Systemtests/BuiltInFunctions/TestType.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <stddef.h>

#include "catch.hpp"
#include "catch_amalgamated.hpp"
#include "assert.h"
#include "mpy_aliases.h"
#include "mpy_obj.h"
Expand Down
26 changes: 5 additions & 21 deletions c-runtime/test/Systemtests/Classes/TestClassInheritance.cpp
Original file line number Diff line number Diff line change
@@ -1,37 +1,19 @@
#define CATCH_CONFIG_RUNNER
#define CATCH_CONFIG_MAIN

#include <stddef.h>

#include "catch.hpp"
#include "catch_amalgamated.hpp"
#include "test/test_helpers.h"
#include "test/Classes/TestClassInheritanceHelpers.h"

__MPyObj *A;

__MPyObj *B;

int main( int argc, char* argv[] ) {
// global setup...
__mpy_builtins_setup();

int result = 0;

try{
result = Catch::Session().run( argc, argv );
}
catch (const std::runtime_error& error){
printf("");
}

__mpy_builtins_cleanup();
// global clean-up... Why is this working ? ....

return result;
}

int inheritance(){
__MPyObj *child;

__mpy_builtins_setup();
child = __mpy_obj_init_object();
__mpy_obj_ref_inc(child);

Expand Down Expand Up @@ -65,6 +47,8 @@ int inheritance(){
__mpy_obj_ref_dec(A);
__mpy_obj_ref_dec(B);

__mpy_builtins_cleanup();

return 0;
}

Expand Down
34 changes: 13 additions & 21 deletions c-runtime/test/Systemtests/Classes/TestClassInit.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#define CATCH_CONFIG_RUNNER
#define CATCH_CONFIG_MAIN

#include <stddef.h>

#include "catch.hpp"
#include "catch_amalgamated.hpp"
#include "test/test_helpers.h"
#include "test/Classes/TestClassInitHelpers.h"

Expand All @@ -12,28 +12,12 @@ __MPyObj *init_one_param;

__MPyObj *init_multiple_params;

int main( int argc, char* argv[] ) {
// global setup...
__mpy_builtins_setup();

int result = 0;

try{
result = Catch::Session().run( argc, argv );
}
catch (const std::runtime_error& error){
printf("");
}

__mpy_builtins_cleanup();
// global clean-up... Why is this working ? ....

return result;
}

int init_class_no_params(){
__MPyObj *x;

__mpy_builtins_setup();

__mpy_builtins_setup();
x = __mpy_obj_init_object();
__mpy_obj_ref_inc(x);

Expand All @@ -58,12 +42,15 @@ int init_class_no_params(){

__mpy_obj_ref_dec(init_no_params);

__mpy_builtins_cleanup();

return 0;
}

int init_class_one_param(){
__MPyObj *x;

__mpy_builtins_setup();
x = __mpy_obj_init_object();
__mpy_obj_ref_inc(x);

Expand All @@ -89,12 +76,15 @@ int init_class_one_param(){

print_mpyobj(x);

__mpy_builtins_cleanup();

return 0;
}

int init_class_multiple_params(){
__MPyObj *x;

__mpy_builtins_setup();
x = __mpy_obj_init_object();
__mpy_obj_ref_inc(x);

Expand All @@ -119,6 +109,8 @@ int init_class_multiple_params(){

print_mpyobj(x);

__mpy_builtins_cleanup();

return 0;
}

Expand Down
32 changes: 11 additions & 21 deletions c-runtime/test/Systemtests/Classes/TestClassInitThrows.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#define CATCH_CONFIG_RUNNER
#define CATCH_CONFIG_MAIN

#include <stddef.h>

#include "catch.hpp"
#include "catch_amalgamated.hpp"
#include "test/test_helpers.h"
#include "test/Classes/TestClassInitHelpers.h"

Expand All @@ -14,28 +14,10 @@ __MPyObj *init_multiple_params;

void exit(int status);

int main( int argc, char* argv[] ) {
// global setup...
__mpy_builtins_setup();

int result = 0;

try{
result = Catch::Session().run( argc, argv );
}
catch (const std::runtime_error& error){
printf("");
}

__mpy_builtins_cleanup();
// global clean-up... Why is this working ? ....

return result;
}

int init_class_no_params_but_one_provided(){
__MPyObj *x;

__mpy_builtins_setup();
x = __mpy_obj_init_object();
__mpy_obj_ref_inc(x);

Expand All @@ -62,12 +44,15 @@ int init_class_no_params_but_one_provided(){

__mpy_obj_ref_dec(init_no_params);

__mpy_builtins_cleanup();

return 0;
}

int init_class_one_param_but_none_provided(){
__MPyObj *x;

__mpy_builtins_setup();
x = __mpy_obj_init_object();
__mpy_obj_ref_inc(x);

Expand All @@ -93,12 +78,15 @@ int init_class_one_param_but_none_provided(){

print_mpyobj(x);

__mpy_builtins_cleanup();

return 0;
}

int init_class_multiple_params_but_less_provided(){
__MPyObj *x;

__mpy_builtins_setup();
x = __mpy_obj_init_object();
__mpy_obj_ref_inc(x);

Expand All @@ -123,6 +111,8 @@ int init_class_multiple_params_but_less_provided(){

print_mpyobj(x);

__mpy_builtins_cleanup();

return 0;
}

Expand Down
Loading

0 comments on commit 2a9b31b

Please sign in to comment.