julienne_assert_s.f90 Source File


This file depends on

sourcefile~~julienne_assert_s.f90~~EfferentGraph sourcefile~julienne_assert_s.f90 julienne_assert_s.f90 sourcefile~julienne_assert_m.f90 julienne_assert_m.f90 sourcefile~julienne_assert_s.f90->sourcefile~julienne_assert_m.f90 sourcefile~julienne_test_diagnosis_m.f90 julienne_test_diagnosis_m.F90 sourcefile~julienne_assert_m.f90->sourcefile~julienne_test_diagnosis_m.f90 sourcefile~julienne_string_m.f90 julienne_string_m.F90 sourcefile~julienne_test_diagnosis_m.f90->sourcefile~julienne_string_m.f90

Source Code

! Copyright (c) 2024-2025, The Regents of the University of California and Sourcery Institute
! Terms of use are as specified in LICENSE.txt

submodule(julienne_assert_m) julienne_assert_s
  use assert_m, only : assert_always
  implicit none

contains

  module procedure idiomatic_assert
    character(len=:), allocatable :: description_

    if (.not. test_diagnosis%test_passed()) then
      if (present(description)) then
        description_ =  new_line('') // description // new_line('') // test_diagnosis%diagnostics_string()
      else
        description_ =  new_line('') // test_diagnosis%diagnostics_string()
      end if
      call assert_always(.false., description_, file, line)
    end if

  end procedure

  module procedure logical_assert
    character(len=:), allocatable :: description_

    if (.not. assertion) then
      if (present(description)) then
        description_ =  new_line('') // description // new_line('')
      else
        description_ =  new_line('')
      end if
      call assert_always(.false., description_ , file, line)
    end if

  end procedure

end submodule julienne_assert_s