{"id":19924547,"url":"https://github.com/artemis-beta/fortutf","last_synced_at":"2025-03-01T10:26:29.538Z","repository":{"id":44788667,"uuid":"318641601","full_name":"artemis-beta/FortUTF","owner":"artemis-beta","description":"FORTRAN Unit Test Suite written in FORTRAN","archived":false,"fork":false,"pushed_at":"2024-07-02T17:46:07.000Z","size":5496,"stargazers_count":10,"open_issues_count":4,"forks_count":4,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-01-12T00:26:13.170Z","etag":null,"topics":["fortran","test","test-framework","testing-fortran","unit-testing"],"latest_commit_sha":null,"homepage":"https://artemis-beta.github.io/FortUTF/","language":"Fortran","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/artemis-beta.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-12-04T21:42:32.000Z","updated_at":"2024-11-24T20:41:01.000Z","dependencies_parsed_at":"2023-12-29T12:33:24.186Z","dependency_job_id":"1b4af9a9-aa02-4415-8601-0ef3d27a80fc","html_url":"https://github.com/artemis-beta/FortUTF","commit_stats":{"total_commits":134,"total_committers":5,"mean_commits":26.8,"dds":"0.17164179104477617","last_synced_commit":"694afc80a5362d0711a99f248a25b1b5edd668f5"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artemis-beta%2FFortUTF","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artemis-beta%2FFortUTF/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artemis-beta%2FFortUTF/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artemis-beta%2FFortUTF/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/artemis-beta","download_url":"https://codeload.github.com/artemis-beta/FortUTF/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241351671,"owners_count":19948712,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fortran","test","test-framework","testing-fortran","unit-testing"],"created_at":"2024-11-12T22:18:00.783Z","updated_at":"2025-03-01T10:26:29.528Z","avatar_url":"https://github.com/artemis-beta.png","language":"Fortran","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FORTRAN Unit Test Framework\n\nA purely FORTRANic framework for testing FORTRAN code\n\n[![FortUTF Ubuntu GFortran 13](https://github.com/artemis-beta/FortUTF/actions/workflows/futs.yml/badge.svg)](https://github.com/artemis-beta/FortUTF/actions/workflows/futs.yml)\n[![FortUTF Windows GFortran 13](https://github.com/artemis-beta/FortUTF/actions/workflows/futs_windows.yml/badge.svg)](https://github.com/artemis-beta/FortUTF/actions/workflows/futs_windows.yml)\n[![FortUTF macOS GFortran 13](https://github.com/artemis-beta/FortUTF/actions/workflows/futs_mac.yml/badge.svg)](https://github.com/artemis-beta/FortUTF/actions/workflows/futs_mac.yml)\n\n[![FortUTF Ubuntu Intel 2025](https://github.com/artemis-beta/FortUTF/actions/workflows/futs_intel.yml/badge.svg)](https://github.com/artemis-beta/FortUTF/actions/workflows/futs_intel.yml)\n[![FortUTF Ubuntu lfortran 0.33.0](https://github.com/artemis-beta/FortUTF/actions/workflows/futs_lfortran.yml/badge.svg)](https://github.com/artemis-beta/FortUTF/actions/workflows/futs_lfortran.yml)\n\n[![codecov](https://codecov.io/gh/artemis-beta/FortUTF/branch/master/graph/badge.svg?token=tIwLkKYQ98)](https://codecov.io/gh/artemis-beta/FortUTF)\n\n**NOTE**: As of `v0.1.4-alpha` a GFortran compiler supporting FORTRAN-2008 is required for test run command line arguments.\n\n**NOTE**: Currently FortUTF does not support `lfortran`\n\n## Introduction\n\nFortUTF is Unit Test framework written purely in FORTRAN to be compatible with as many projects as possible, the basis for the test suite is template scripts constructed within CMake during configuration. The framework is still in development so documentation is limited, but I promise once it is complete documentation will be a priority. For now I will introduce the basics.\n\n\n## Writing Tests\n\nAll assertions in the current state can be found in the file `src/assertions.f90`. To write a test you only need to create a file containing one a subroutine for each test you wish to run. You can use the available macro script contained within FortUTF which will construct a main script to build and run the tests.\n\n### Example Project\n\nContained within this repository is an example project which demonstrates usage of the framework in the form:\n\n```bash\ndemo_project/\n├── CMakeLists.txt\n├── src\n│   └── demo_functions.f90\n└── tests\n    └── test_functions.f90\n```\n\nthe functions which we would like to test are contained within the project `src` folder. When building tests it is important that you give this location, or the name of a compiled library to FortUTF using either the variable `SRC_FILES` or `SRC_LIBRARY`, the contents of the `CMakeLists.txt` shows this in practice, and point it to the location of our tests using the `FORTUTF_PROJECT_TEST_DIR` variable.\nIn addition to include a directory containing module (`.mod`) files required\nto build the library being tested set the variable `FORTUTF_PROJECT_MOD_DIR` to this location.\n\n```cmake\nCMAKE_MINIMUM_REQUIRED(VERSION 3.12)\n\nPROJECT(DEMO_PROJ LANGUAGES Fortran)\n\nMESSAGE(STATUS \"[FortUTF Example Project Build]\")\nMESSAGE(STATUS \"\\tProject Source Directory: ${PROJECT_ROOT}\")\n\nGET_FILENAME_COMPONENT(FORTUTF_ROOT ../../ ABSOLUTE)\n\nSET(FORTUTF_PROJECT_TEST_DIR ${CMAKE_CURRENT_SOURCE_DIR}/tests)\nFILE(GLOB SRC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.f90)\n\nINCLUDE(${FORTUTF_ROOT}/cmake/fortutf.cmake)\nFortUTF_Find_Tests()\n```\n\nby including the file `cmake/fortutf.cmake` from within this repository we have access to the `FortUTF_Find_Tests` macro. We can place as many scripts in our `FORTUTF_PROJECT_TEST_DIR` location. An example script for this project is:\n\n```fortran\nMODULE TEST_DEMO_FUNCTIONS\n    USE FORTUTF\n    USE DEMO_FUNCTIONS\n\n    CONTAINS\n    SUBROUTINE TEST_DEMO_FUNC_1\n        USE DEMO_FUNCTIONS, ONLY: DEMO_FUNC_1\n        CALL TAG_TEST(\"TEST_DEMO_FUNC_1\")\n        CALL ASSERT_EQUAL(DEMO_FUNC_1(10), 95)\n    END SUBROUTINE\n    SUBROUTINE TEST_DEMO_FUNC_2\n        USE DEMO_FUNCTIONS, ONLY: DEMO_FUNC_2\n        CALL TAG_TEST(\"TEST_DEMO_FUNC_2\")\n        CALL ASSERT_EQUAL(DEMO_FUNC_2(11D0), 32D0)\n    END SUBROUTINE\nEND MODULE TEST_DEMO_FUNCTIONS\n```\n\nFirstly we must include the `FORTUTF` module in every test script, then in order for FortUFT to be able to provide labels to any failing tests we tag using the `TAG_TEST` subroutine (not providing a tag will name the test `Test \u003cN\u003e` where `N` is the test number). Finally we call a test subroutine, and that's it!\n\nTo build this example we would then just run `cmake` within the project directory:\n\n```bash\ncmake -H. -Bbuild\ncmake --build build\n```\n\nthis will create a script `run_tests.f90` in the build directory and compile it into a binary.\n\n\n## Running the Framework Unit Tests\n\nEven a test framework needs tests! FortUTF uses its own style of running to test\nall the assertions are behaving properly, to run the tests build them by\nrunning cmake with the option:\n\n```bash\ncmake -H. -Bbuild -DBUILD_TESTS=ON\ncmake --build build\n```\n\nthe compiled binary is always named `\u003cPROJECT_NAME\u003e_Tests` and is run to execute the tests:\n\n```bash\n./build/FortUTF_Tests\n```\n\nOptionally you can specify tests to run by the tagged name:\n\n```bash\n./build/FortUTF_Tests TEST_FAIL_EQUAL_CHAR TEST_EQUAL_CHAR\n```\n\n\n## Troubleshooting\n\nIf you experience any problems:\n\n- Try deleting the build directory and starting again.\n- Try putting the test subroutines into a module\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fartemis-beta%2Ffortutf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fartemis-beta%2Ffortutf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fartemis-beta%2Ffortutf/lists"}