Skip to content

Commit

Permalink
Add README.md and minor changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
gha3mi committed Dec 28, 2023
1 parent 995b1ee commit f077853
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 4 deletions.
64 changes: 64 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
[![GitHub](https://img.shields.io/badge/GitHub-ForUnitTest-blue.svg?style=social&logo=github)](https://github.com/gha3mi/forunittest)
[![Version](https://img.shields.io/github/release/gha3mi/forunittest.svg)](https://github.com/gha3mi/forunittest/releases/latest)
[![Documentation](https://img.shields.io/badge/ford-Documentation%20-blueviolet.svg)](https://gha3mi.github.io/forunittest/)
[![License](https://img.shields.io/github/license/gha3mi/forunittest?color=green)](https://github.com/gha3mi/forunittest/blob/main/LICENSE)
[![Build](https://github.com/gha3mi/forunittest/actions/workflows/CI_test.yml/badge.svg)](https://github.com/gha3mi/forunittest/actions/workflows/CI_test.yml)

<!-- <img alt="ForUnitTest" src="https://github.com/gha3mi/forunittest/raw/main/media/logo.png" width="750"> -->

**ForUnitTest**: A Fortran library for unit testing.

## Usage

```fortran
use forunittest
type(unit_test) :: ut
call ut%check(res, expected, tol, msg)
```

See `example/demo.f90` for a complete example.

## fpm dependency

To use `ForUnitTest` as a dependency in your fpm project, include the following line in your `fpm.toml` file:

```toml
[dependencies]
forunittest = {git="https://github.com/gha3mi/forunittest.git"}
```

## How to Run the Demo

**Clone the repository:**

Clone the `ForUnitTest` repository from GitHub using:

```shell
git clone https://github.com/gha3mi/forunittest.git
cd forunittest
```

**Run the demo:**

```shell
fpm run --example demo
```

## API documentation

The most up-to-date API documentation for the main branch is available
[here](https://gha3mi.github.io/forunittest/).
To generate the API documentation for `ForUnitTest` using
[ford](https://github.com/Fortran-FOSS-Programmers/ford) run the following
command:

```shell
ford ford.yml
```

## Contributing

Contributions to `ForUnitTest` are welcome!
If you find any issues or would like to suggest improvements, please open an issue.
4 changes: 2 additions & 2 deletions example/demo.f90
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ program demo
! 'tol' is an optional real(rk) parameter, default value is 'tiny(0.0_rk)'
! 'msg' is an optional character parameter, default value is 'forunittest'
! Note: 'res' and 'expected' must have the same type and shape
call ut%check(res=1.0_rk, expected=1.0_rk, tol=1e-5_rk, msg="demo test 1") ! 'tol' is optional
call ut%check(res=2.0_rk, expected=1.0_rk, tol=1e-5_rk, msg="demo test 2") ! 'tol' is optional
call ut%check(res=1.0_rk, expected=1.0_rk, tol=1e-5_rk, msg="demo test 1")
call ut%check(res=2.0_rk, expected=1.0_rk, tol=1e-5_rk, msg="demo test 2")

end program demo
3 changes: 1 addition & 2 deletions workspace.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"${workspaceFolder}/src",
"${workspaceFolder}/test",
"${workspaceFolder}/app"
],
"julia.environmentPath": "/pvt/prj/gh/forunittest"
]
}
}

0 comments on commit f077853

Please sign in to comment.