-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d308062
commit 7939ab0
Showing
4 changed files
with
92 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
# fchem_db | ||
# forsus | ||
|
||
Pure chemical compounds database and general API. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,23 @@ | ||
name = "fchem_db" | ||
name = "forsus" | ||
version = "0.1.0" | ||
license = "license" | ||
author = "Federico E. Benelli" | ||
maintainer = "fedebenelli@outlook.com" | ||
maintainer = "federico.benelli@mi.unc.edu.ar" | ||
copyright = "Copyright 2024, Federico E. Benelli" | ||
|
||
[build] | ||
auto-executables = true | ||
auto-tests = true | ||
auto-examples = true | ||
module-naming = false | ||
|
||
[install] | ||
library = false | ||
|
||
[fortran] | ||
implicit-typing = false | ||
implicit-external = false | ||
source-form = "free" | ||
|
||
[dependencies] | ||
json-fortran = {git = "https://github.com/jacobwilliams/json-fortran" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
#!/bin/bash | ||
DESIRED_COVERAGE=90 | ||
|
||
DID_TEST=0 | ||
|
||
COVER=0 | ||
|
||
echoerr() { echo -e "$@" 1>&2; } | ||
|
||
install_fpm() { | ||
apt install pipx | ||
pipx install fpm | ||
} | ||
|
||
green() { | ||
echo -e "\e[1;32m$@\e[m" | ||
} | ||
|
||
red() { | ||
echo -e "\e[1;31m$@\e[m" | ||
} | ||
|
||
run_test() { | ||
echo y | fpm clean | ||
DID_TEST=1 | ||
echo Checking tests files names... | ||
NAMING_ERRORS=0 | ||
for file in $(find test/*f90); do | ||
filename="$(basename $file)" | ||
prefix="$(echo $filename | cut -d '_' -f1)" | ||
|
||
if [ "$prefix" = "test" ]; then | ||
green "$file [OK]" | ||
else | ||
NAMING_ERRORS=$((NAMING_ERRORS + 1)) | ||
red "$file [X]" | ||
fi | ||
done | ||
|
||
[ $NAMING_ERRORS -ge 1 ] && | ||
echoerr "There are wrongly named files in the test directory" | ||
|
||
echo Running tests... | ||
fpm test --flag "--coverage" | ||
} | ||
|
||
run_coverage() { | ||
COVER=$(gcovr \ | ||
--exclude "build" \ | ||
--exclude "test/test_runner.f90" \ | ||
--exclude "src/adiff/hyperdual.f90" \ | ||
--exclude "example" \ | ||
--exclude "src/legacy/*" \ | ||
--exclude "app"\ | ||
--exclude "tools" \ | ||
--fail-under-branch 90) | ||
echo "$COVER" | ||
COVER=$(echo "$COVER" | grep TOTAL | awk '{print $4}' | tr -d '%') | ||
} | ||
|
||
resumee() { | ||
[ $DID_TEST = 1 ] && | ||
echo There has been $NAMING_ERRORS test naming errors | ||
|
||
if [ ${COVER} -le 90 ]; then | ||
echo "COVERAGE: " $(red $COVER) | ||
else | ||
echo "COVERAGE: " $(green $COVER) | ||
fi | ||
} | ||
|
||
case $1 in | ||
"install") install_fpm;; | ||
"test") run_test;; | ||
"coverage") run_coverage;; | ||
*) | ||
run_test | ||
run_coverage;; | ||
esac | ||
|
||
resumee |