Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
aradi committed Oct 3, 2024
1 parent a1b12f9 commit e8a4b8a
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 56 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ jobs:
- name: Test fpm export
run: |
fpm run -C test/export/${INTERFACE} testapp
fpm run -C test/export/${INTERFACE} testapp testapp_fpp
34 changes: 34 additions & 0 deletions include/fortuno_serial.fpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
! This file is part of Fortuno.
! Licensed under the BSD-2-Clause Plus Patent license.
! SPDX-License-Identifier: BSD-2-Clause-Patent

#ifndef __FORTUNO_SERIAL_FPP__
#define __FORTUNO_SERIAL_FPP__

#define CHECK(cond)\
block;\
use fortuno_serial, only : serial_check;\
call serial_check(cond, file=__FILE__, line=__LINE__);\
end block;

#define CHECK_MSG(cond, msg)\
block;\
use fortuno_serial, only : serial_check;\
call serial_check(cond, msg, file=__FILE__, line=__LINE__);\
end block;

#define ASSERT(cond)\
block;\
use fortuno_serial, only : serial_check, serial_check_failed;\
call serial_check(cond, file=__FILE__, line=__LINE__);\
if (serial_check_failed()) return;\
end block;

#define ASSERT_MSG(cond, msg)\
block;\
use fortuno_serial, only : serial_check, serial_check_failed;\
call serial_check(cond, msg, file=__FILE__, line=__LINE__);\
if (serial_check_failed()) return;\
end block;

#endif
19 changes: 8 additions & 11 deletions test/export/serial/app/testapp_fpp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,9 @@

!> Unit tests
module testapp_fpp_tests
use fortuno_serial, only : is_equal, test => serial_case_item, test_item
use fortuno_serial, only : is_equal, test => serial_case_item, test_list
implicit none

private
public :: test_items

contains


Expand All @@ -20,24 +17,24 @@ subroutine test_success()
end subroutine test_success


function test_items() result(testitems)
type(test_item), allocatable :: testitems(:)
function tests()
type(test_list) :: tests

testitems = [&
tests = test_list([&
test("success", test_success)&
]
])

end function test_items
end function tests

end module testapp_fpp_tests


!> Test app driving Fortuno unit tests
program testapp_fpp
use testapp_fpp_tests, only : test_items
use fortuno_serial, only : execute_serial_cmd_app
use testapp_fpp_tests, only : tests
implicit none

call execute_serial_cmd_app(testitems=test_items())
call execute_serial_cmd_app(tests())

end program testapp_fpp
43 changes: 0 additions & 43 deletions test/export/serial/app/testapp_fypp.fypp

This file was deleted.

6 changes: 5 additions & 1 deletion test/export/serial/fpm.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,8 @@ fortuno = { path = "../../../" }

[[executable]]
name = "testapp"
main = "testapp.f90"
main = "testapp.f90"

[[executable]]
name = "testapp_fpp"
main = "testapp_fpp.F90"

0 comments on commit e8a4b8a

Please sign in to comment.