@@ -36,6 +36,7 @@ subroutine collect_read_ctfile(testsuite)
3636 & new_unittest(" valid2-mol" , test_valid2_mol), &
3737 & new_unittest(" valid3-mol" , test_valid3_mol), &
3838 & new_unittest(" valid4-mol" , test_valid4_mol), &
39+ & new_unittest(" valid5-mol" , test_valid5_mol), &
3940 & new_unittest(" invalid1-mol" , test_invalid1_mol, should_fail= .true. ), &
4041 & new_unittest(" invalid2-mol" , test_invalid2_mol, should_fail= .true. ), &
4142 & new_unittest(" invalid3-mol" , test_invalid3_mol, should_fail= .true. ), &
@@ -386,6 +387,63 @@ subroutine test_valid4_mol(error)
386387end subroutine test_valid4_mol
387388
388389
390+ subroutine test_valid5_mol (error )
391+
392+ ! > Error handling
393+ type (error_type), allocatable , intent (out ) :: error
394+
395+ type (structure_type) :: struc
396+ integer :: unit
397+
398+ open (status= ' scratch' , newunit= unit)
399+ write (unit, ' (a)' ) &
400+ " " , &
401+ " Mrv1823 10191918163D " , &
402+ " " , &
403+ " 12 12 0 0 0 0 999 V2000" , &
404+ " -0.0090 -0.0157 -0.0000 C 0 " , &
405+ " -0.7131 1.2038 -0.0000 C 0 " , &
406+ " 1.3990 -0.0157 -0.0000 C 0 " , &
407+ " -0.0090 2.4232 -0.0000 C 0 " , &
408+ " 2.1031 1.2038 -0.0000 C 0 " , &
409+ " 1.3990 2.4232 0.0000 C 0 " , &
410+ " -0.5203 -0.9011 -0.0000 H 0 " , &
411+ " -1.7355 1.2038 0.0000 H 0 " , &
412+ " 1.9103 -0.9011 0.0000 H 0 " , &
413+ " -0.5203 3.3087 0.0000 H 0 " , &
414+ " 3.1255 1.2038 0.0000 H 0 " , &
415+ " 1.9103 3.3087 -0.0000 H 0 " , &
416+ " 2 1 4 0 " , &
417+ " 3 1 4 0 " , &
418+ " 4 2 4 0 " , &
419+ " 5 3 4 0 " , &
420+ " 6 4 4 0 " , &
421+ " 6 5 4 0 " , &
422+ " 1 7 1 0 " , &
423+ " 2 8 1 0 " , &
424+ " 3 9 1 0 " , &
425+ " 4 10 1 0 " , &
426+ " 5 11 1 0 " , &
427+ " 6 12 1 0 " , &
428+ " M END"
429+ rewind(unit)
430+
431+ call read_molfile(struc, unit, error)
432+ close (unit)
433+ if (allocated (error)) return
434+
435+ call check(error, .not. allocated (struc% comment), " Empty comment line should not be saved" )
436+ if (allocated (error)) return
437+ call check(error, struc% nat, 12 , " Number of atoms does not match" )
438+ if (allocated (error)) return
439+ call check(error, struc% nid, 2 , " Number of species does not match" )
440+ if (allocated (error)) return
441+ call check(error, struc% nbd, 12 , " Number of bonds does not match" )
442+ if (allocated (error)) return
443+
444+ end subroutine test_valid5_mol
445+
446+
389447subroutine test_invalid1_mol (error )
390448
391449 ! > Error handling
0 commit comments