From a4134b4552092ccb2366dbf0b83435482541045a Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 26 Jan 2020 20:24:09 +0100 Subject: [PATCH] doing some internal checks trivial, but better safe then sorry --- src/IO.f90 | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/IO.f90 b/src/IO.f90 index 40e32b8cd..bc9f494fe 100644 --- a/src/IO.f90 +++ b/src/IO.f90 @@ -49,11 +49,11 @@ contains !-------------------------------------------------------------------------------------------------- !> @brief does nothing. -! ToDo: needed? !-------------------------------------------------------------------------------------------------- subroutine IO_init write(6,'(/,a)') ' <<<+- IO init -+>>>'; flush(6) + call unitTest end subroutine IO_init @@ -914,4 +914,23 @@ real(pReal) function verifyFloatValue(string) end function verifyFloatValue + +!-------------------------------------------------------------------------------------------------- +!> @brief check correctness of IO functions +!-------------------------------------------------------------------------------------------------- +subroutine unitTest + + if(dNeq(1.0_pReal, verifyFloatValue('1.0'))) call IO_error(401,ext_msg='verifyFloatValue') + if(dNeq(1.0_pReal, verifyFloatValue('1e0'))) call IO_error(401,ext_msg='verifyFloatValue') + if(dNeq(0.1_pReal, verifyFloatValue('1e-1'))) call IO_error(401,ext_msg='verifyFloatValue') + + if(3112019 /= verifyIntValue( '3112019')) call IO_error(401,ext_msg='verifyIntValue') + if(3112019 /= verifyIntValue(' 3112019')) call IO_error(401,ext_msg='verifyIntValue') + if(-3112019 /= verifyIntValue('-3112019')) call IO_error(401,ext_msg='verifyIntValue') + if(3112019 /= verifyIntValue('+3112019 ')) call IO_error(401,ext_msg='verifyIntValue') + + if(any([2,1,2,4,4] /= IO_stringPos('aa b'))) call IO_error(401,ext_msg='IO_stringPos') + +end subroutine unitTest + end module IO