Fortran · 1180 bytes Raw Blame History
1 program test_scaffold
2 use fgof_watch, only : init_watch, poll_watch, reset_watch
3 use fgof_watch_types, only : watch_event, watch_options, watch_session
4 implicit none
5
6 type(watch_event), allocatable :: events(:)
7 type(watch_session) :: session
8
9 type(watch_options) :: options
10
11 options = watch_options(recursive=.false.)
12 call init_watch(session, "src", options)
13
14 if (.not. session%active) error stop "watch session should be active"
15 if (.not. allocated(session%root)) error stop "watch root should be allocated"
16 if (session%root /= "src") error stop "watch root should match init input"
17 if (session%options%recursive) error stop "recursive flag should follow options"
18 if (session%last_error_code /= 0) error stop "fresh session should start without an error"
19
20 events = poll_watch(session)
21 if (.not. allocated(events)) error stop "poll should always allocate an event batch"
22 if (size(events) /= 0) error stop "placeholder poll should return an empty batch"
23
24 call reset_watch(session)
25 if (session%active) error stop "reset should deactivate session"
26 if (allocated(session%root)) error stop "reset should clear root path"
27 end program test_scaffold
28