Skip to content

Commit 6d725e3

Browse files
committed
Merge pull request #71 from zbeekman/check-readme-programs-issue-67
Test stand alone programs in the README.md
2 parents a4497d4 + 0ab6fc1 commit 6d725e3

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

.travis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ cache: apt
99
env:
1010
global:
1111
- DEPENDS="gfortran-4.9 binutils"
12+
- CHECK_README_PROGS="yes"
1213
matrix:
1314
# CMake build with unit tests, no documentation
1415
# Allow to fail for now until tests are fixed
@@ -34,6 +35,7 @@ env:
3435
FoBiS="no"
3536

3637
before_install:
38+
- if [[ $CHECK_README_PROGS == [yY]* ]]; then wget http://people.sc.fsu.edu/~jburkardt/f_src/f90split/f90split.f90; fi
3739
- if [[ $DOCS == [yY]* ]]; then export DEPENDS="$DEPENDS exuberant-ctags"; fi
3840
- sudo apt-add-repository -y ppa:ubuntu-toolchain-r/test
3941
- if [[ $SPECIFIC_DEPENDS == *cmake* ]]; then sudo apt-add-repository -y ppa:kalakris/cmake; fi
@@ -46,6 +48,7 @@ install:
4648
- sudo ln -fs /usr/bin/gfortran-4.9 /usr/bin/gfortran && gfortran --version
4749
- if [[ $FoBiS == [yY]* ]]; then sudo -H pip install FoBiS.py==1.5.5 && FoBiS.py --version; fi
4850
- if [[ $DOCS == [yY]* ]]; then sudo dpkg -i robodoc_4.99.41-1_amd64.deb && robodoc --version; fi
51+
- if [[ $CHECK_README_PROGS == [yY]* ]]; then gfortran -o f90split f90split.f90 && ./f90split README.md && shopt -s extglob && for f in !(README|CONTRIBUTING).md; do mv $f src/tests/jf_test_${f%.md}.f90; done; rm f90split.f90 f90split; fi
4952

5053
script:
5154
- echo $BUILD_SCRIPT

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ for more examples. The source files may be found in `src/tests/`.
9494
call json_initialize()
9595
9696
! read the file
97-
call json%load_file(filename = 'test1.json')
97+
call json%load_file(filename = '../files/test1.json')
9898
9999
! print the file to the console
100100
call json%print_file()
@@ -107,6 +107,7 @@ for more examples. The source files may be found in `src/tests/`.
107107
108108
! clean up
109109
call json%destroy()
110+
if (json_failed()) stop 1
110111
111112
end program example1
112113
```
@@ -182,6 +183,7 @@ of `json_value` pointers. For more examples see unit tests 2,4 and 7 in `src/te
182183
183184
!cleanup:
184185
call json_destroy(p)
186+
if (json_failed()) stop 1
185187
186188
end program example2
187189
```

src/json_module.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ module json_module
154154
integer(IK),parameter :: rp_addl_safety = 1
155155
integer(IK),parameter :: real_precision = rp_safety_factor*precision(1.0_RK) + rp_addl_safety
156156
! Get the number of possible digits in the exponent when using decimal number system
157-
integer(IK),parameter :: real_exponent_digits = ceiling( log10( &
157+
integer(IK),parameter :: real_exponent_digits = floor( 1 + log10( &
158158
real(max(maxexponent(1.0_RK),abs(minexponent(1.0_RK))),kind=RK) &
159159
) )
160160
! 4*precision to prevent rounding errors

0 commit comments

Comments
 (0)